multipath: fix gcc 4.8 uninitialized variable warning
authorMartin Wilck <mwilck@suse.com>
Tue, 8 Jan 2019 11:32:45 +0000 (12:32 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Tue, 8 Jan 2019 12:18:17 +0000 (13:18 +0100)
gcc 4.8 complained about "err" not being initialized. Fix, and
simplify.

Signed-off-by: Martin Wilck <mwilck@suse.com>
multipath/main.c

index a25e1b4..5abb118 100644 (file)
@@ -410,7 +410,7 @@ static int find_multipaths_check_timeout(const struct path *pp, long tmo,
        struct timespec now, ftimes[2], tdiff;
        struct stat st;
        long fd;
-       int r, err, retries = 0;
+       int r, retries = 0;
 
        clock_gettime(CLOCK_REALTIME, &now);
 
@@ -430,8 +430,6 @@ retry:
        if (fd != -1) {
                pthread_cleanup_push(close_fd, (void *)fd);
                r = fstat(fd, &st);
-               if (r != 0)
-                       err = errno;
                pthread_cleanup_pop(1);
 
        } else if (tmo > 0) {
@@ -460,15 +458,12 @@ retry:
                                path, strerror(errno));
                }
                r = fstat(fd, &st);
-               if (r != 0)
-                       err = errno;
                pthread_cleanup_pop(1);
        } else
                return FIND_MULTIPATHS_NEVER;
 
        if (r != 0) {
-               condlog(1, "%s: error in fstat for %s: %s", __func__,
-                       path, strerror(err));
+               condlog(1, "%s: error in fstat for %s: %m", __func__, path);
                return FIND_MULTIPATHS_ERROR;
        }