[PATCH 1/3] mkfs.minix: clean up gcc warnings

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

 



From: Randy Dunlap <randy.dunlap@xxxxxxxxxx>

* clean up code, gcc warnings
  (try compilation with "-Wall -Wp,-D_FORTIFY_SOURCE=2")

Builds cleanly on x86_32 and x86_64.

mkfs.minix.c:595: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result

Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
---
 disk-utils/mkfs.minix.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- util-linux-ng-2.13.orig/disk-utils/mkfs.minix.c
+++ util-linux-ng-2.13/disk-utils/mkfs.minix.c
@@ -592,7 +592,10 @@ get_list_blocks(char *filename) {
 		die(_("can't open file of bad blocks"));
 
 	while (!feof(listfile)) {
-		fscanf(listfile,"%ld\n", &blockno);
+		if (fscanf(listfile,"%ld\n", &blockno) != 1) {
+			printf(_("badblock number input error on line %d\n"), badblocks);
+			die(_("cannot read badblocks file"));
+		}
 		mark_zone(blockno);
 		badblocks++;
 	}
-
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