[dm-devel] [PATCH 09/72] libmultipath: allocate_binding(): error out for id=0

Martin Wilck Martin.Wilck at suse.com
Sat Oct 12 21:27:48 UTC 2019


From: Martin Wilck <mwilck at suse.com>

Only for positive id can we allocate a binding. All current
callers make sure the id is positive. Yet, fix the implementation
in allocate_binding(), too.

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 libmultipath/alias.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libmultipath/alias.c b/libmultipath/alias.c
index 767800d0..2df34f32 100644
--- a/libmultipath/alias.c
+++ b/libmultipath/alias.c
@@ -233,8 +233,9 @@ allocate_binding(int fd, const char *wwid, int id, const char *prefix)
 	char *alias, *c;
 	int i;
 
-	if (id < 0) {
-		condlog(0, "Bindings file full. Cannot allocate new binding");
+	if (id <= 0) {
+		condlog(0, "%s: cannot allocate new binding for id %d",
+			__func__, id);
 		return NULL;
 	}
 
-- 
2.23.0





More information about the dm-devel mailing list