]> granicus.if.org Git - psmisc/commitdiff
prtstat: check fgets return value
authorSami Kerola <sami.kerola@tomtom.com>
Wed, 4 Jan 2012 13:54:29 +0000 (14:54 +0100)
committerCraig Small <csmall@users.sourceforge.net>
Wed, 25 Jan 2012 10:47:33 +0000 (21:47 +1100)
prtstat.c:234:8: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Sami Kerola <sami.kerola@tomtom.com>
src/prtstat.c

index 4178a257ae4361a0071c2c6d87523b398adc7f19..7ed2bee9ca2ecd651a5fcdbf05d8e95f4b504dd1 100644 (file)
@@ -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++;