From: Sami Kerola Date: Wed, 4 Jan 2012 13:54:29 +0000 (+0100) Subject: prtstat: check fgets return value X-Git-Tag: v22.15~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acb39bbb4900f18eecd3956049f2411bdb6944ba;p=psmisc prtstat: check fgets return value prtstat.c:234:8: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Sami Kerola --- diff --git a/src/prtstat.c b/src/prtstat.c index 4178a25..7ed2bee 100644 --- a/src/prtstat.c +++ b/src/prtstat.c @@ -231,7 +231,7 @@ static void print_stat(const int pid, const opt_type options) } free(pathname); - fgets(buf,BUFSIZ,fp); + if (fgets(buf,BUFSIZ,fp) == NULL) return; bptr = strchr(buf, '('); if (bptr == NULL) return; bptr++;