From f812dd669df150f2cb6a13d6ca6e1a2891a60219 Mon Sep 17 00:00:00 2001 From: Stefan Assmann Date: Tue, 30 May 2017 08:25:33 +0200 Subject: [PATCH] check return value of fgets Following warning was observed: init.c: In function 'mutt_init': mutt.h:53:15: warning: ignoring return value of 'fgets_unlocked', declared with attribute warn_unused_result [-Wunused-result] #define fgets fgets_unlocked init.c:4053:7: note: in expansion of macro 'fgets' fgets(buffer, sizeof(buffer), f); ^~~~~ Added code that checks return value. Signed-off-by: Stefan Assmann --- init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.c b/init.c index 49c0c7e61..63226e696 100644 --- a/init.c +++ b/init.c @@ -4049,8 +4049,8 @@ void mutt_init(int skip_sys_rc, struct List *commands) if ((f = safe_fopen(SYSCONFDIR "/nntpserver", "r"))) { - buffer[0] = '\0'; - fgets(buffer, sizeof(buffer), f); + if (fgets(buffer, sizeof(buffer), f) == NULL) + buffer[0] = '\0'; p = buffer; SKIPWS(p); c = p; -- 2.40.0