From 9b9ef2f6d25f3f2f0a07b3055ee5aee025802537 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Thu, 22 Jan 2015 00:22:10 -0600 Subject: [PATCH] wmfsm: Fix -Wunused-result compiler warnings. In particular, if fscanf does not read the expected number of items from /etc/mtab, print a warning message. --- wmfsm/wmfsm/wmfsm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wmfsm/wmfsm/wmfsm.c b/wmfsm/wmfsm/wmfsm.c index add5290..01bf326 100644 --- a/wmfsm/wmfsm/wmfsm.c +++ b/wmfsm/wmfsm/wmfsm.c @@ -512,9 +512,11 @@ readFileSystems() while (!feof(fp) && numberfs < 100) { #if defined(SunOS) /* only five entries per row in /etc/mnttab */ - fscanf(fp, "%s %s %s %s %s\n", dummy, mountPoint, fstype, options, dummy); + if (fscanf(fp, "%s %s %s %s %s\n", dummy, mountPoint, fstype, options, dummy) < 5) + fprintf(stderr, "%s:/etc/mnttab not in expected format\n", myName); #else - fscanf(fp, "%s %s %s %s %s %s\n", dummy, mountPoint, fstype, options, dummy, dummy); + if (fscanf(fp, "%s %s %s %s %s %s\n", dummy, mountPoint, fstype, options, dummy, dummy) < 6) + fprintf(stderr, "%s:/etc/mtab not in expected format\n", myName); #endif if (