From 03f0d3e9f5ac49f73f70b6d48e497063cfa7a472 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 3 Oct 2007 14:15:32 -0700 Subject: [PATCH] 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 --- mount/swapon.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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. -- 2.39.5