diff mbox series

[2/3] multipath: fix gcc 4.8 uninitialized variable warning

Message ID 20190108113246.5903-3-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-tools: compilation fixes | expand

Commit Message

Martin Wilck Jan. 8, 2019, 11:32 a.m. UTC
gcc 4.8 complained about "err" not being initialized. Fix, and
simplify.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 multipath/main.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/multipath/main.c b/multipath/main.c
index a25e1b4f..5abb1181 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -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;
 	}