[PATCH 3/3] mount-swapon: 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")

swapon.c:102: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result

Builds cleanly on x86_32 and x86_64.

Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
---
 mount/swapon.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- util-linux-ng-2.13.orig/mount/swapon.c
+++ util-linux-ng-2.13/mount/swapon.c
@@ -99,7 +99,9 @@ read_proc_swaps(void) {
 		return;		/* nothing wrong */
 
 	/* skip the first line */
-	fgets(line, sizeof(line), swaps);
+	if (!fgets(line, sizeof(line), swaps))
+		fprintf (stderr, _("%s: fgets of \"%s\" is empty\n"),
+			progname, PROC_SWAPS);
 
 	while (fgets(line, sizeof(line), swaps)) {
 		/*
-
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