From: Randy Dunlap Date: Wed, 3 Oct 2007 21:15:32 +0000 (-0700) Subject: swapon: clean up gcc warnings X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03f0d3e9f5ac49f73f70b6d48e497063cfa7a472;p=util-linux swapon: clean up gcc warnings 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 Signed-off-by: Karel Zak --- diff --git a/mount/swapon.c b/mount/swapon.c index ed91afc0..84b047da 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -99,8 +99,12 @@ 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: %s: unexpected file format\n"), + progname, PROC_SWAPS); + fclose(swaps); + return; + } while (fgets(line, sizeof(line), swaps)) { /* * Cut the line "swap_device ... more info" after device.