libmultipath: allocate_binding(): error out for id=0
authorMartin Wilck <mwilck@suse.com>
Sat, 12 Oct 2019 21:27:48 +0000 (21:27 +0000)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Mon, 2 Mar 2020 08:16:37 +0000 (09:16 +0100)
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@suse.com>
libmultipath/alias.c

index 767800d..2df34f3 100644 (file)
@@ -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;
        }