[PATCH 2/3] mount-fstab: clean up gcc warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Randy Dunlap <randy.dunlap@xxxxxxxxxx>

Fix strict gcc warnings in tailf that come from using:
  ("-Wall -Wp,-D_FORTIFY_SOURCE=2")

fstab.c:770: warning: ignoring return value of 'chown', declared with attribute warn_unused_result

Builds cleanly on x86_32 and x86_64.

Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
---
 mount/fstab.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- util-linux-ng-2.13.orig/mount/fstab.c
+++ util-linux-ng-2.13/mount/fstab.c
@@ -766,8 +766,13 @@ update_mtab (const char *dir, struct my_
 	   * from the present mtab before renaming.
 	   */
 	    struct stat sbuf;
-	    if (stat (MOUNTED, &sbuf) == 0)
-		chown (MOUNTED_TEMP, sbuf.st_uid, sbuf.st_gid);
+	    if (stat (MOUNTED, &sbuf) == 0) {
+		if (chown (MOUNTED_TEMP, sbuf.st_uid, sbuf.st_gid) < 0) {
+			int err = errno;
+			fprintf (stderr, _("Cannot chown of %s: %s\n"),
+				MOUNTED_TEMP, strerror(err));
+		}
+	    }
 	}
 
 	/* rename mtemp to mtab */
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux