multipath-tools: Set errno mpath_recv_reply() when failure
authorGris Ge <fge@redhat.com>
Fri, 20 Jan 2017 13:39:01 +0000 (21:39 +0800)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 10 Feb 2017 11:36:31 +0000 (12:36 +0100)
Enforce what mpath_cmd.h states "-1 on failure (with errno set)" for
mpath_recv_reply() by set errno and return -1 on failure.

Signed-off-by: Gris Ge <fge@redhat.com>
libmpathcmd/mpath_cmd.c

index 7fc9e98..856e6b4 100644 (file)
@@ -141,7 +141,7 @@ int mpath_recv_reply(int fd, char **reply, unsigned int timeout)
        *reply = NULL;
        len = mpath_recv_reply_len(fd, timeout);
        if (len <= 0)
-               return len;
+               return -1;
        *reply = malloc(len);
        if (!*reply)
                return -1;
@@ -149,7 +149,7 @@ int mpath_recv_reply(int fd, char **reply, unsigned int timeout)
        if (err) {
                free(*reply);
                *reply = NULL;
-               return err;
+               return -1;
        }
        return 0;
 }