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>
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.