summaryrefslogtreecommitdiffstats
path: root/mount/swapon.c
diff options
context:
space:
mode:
authorRandy Dunlap2007-10-03 23:15:32 +0200
committerKarel Zak2007-10-10 23:39:06 +0200
commit03f0d3e9f5ac49f73f70b6d48e497063cfa7a472 (patch)
tree31cb399f77c2cb490ca3e51f2d987ed227236901 /mount/swapon.c
parentpo: update de.po (from translationproject.org) (diff)
downloadkernel-qcow2-util-linux-03f0d3e9f5ac49f73f70b6d48e497063cfa7a472.tar.gz
kernel-qcow2-util-linux-03f0d3e9f5ac49f73f70b6d48e497063cfa7a472.tar.xz
kernel-qcow2-util-linux-03f0d3e9f5ac49f73f70b6d48e497063cfa7a472.zip
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 <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/swapon.c')
-rw-r--r--mount/swapon.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mount/swapon.c b/mount/swapon.c
index ed91afc0c..84b047da2 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.