]> granicus.if.org Git - psmisc/commitdiff
killall: check fscanf return value
authorSami Kerola <sami.kerola@tomtom.com>
Wed, 4 Jan 2012 14:02:07 +0000 (15:02 +0100)
committerCraig Small <csmall@users.sourceforge.net>
Wed, 25 Jan 2012 10:49:15 +0000 (21:49 +1100)
killall.c:138:10: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]

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

index a27367844ee0acda4d280e9b819306724966022e..656a335282dc648949fb1cc5abb4f26e46fe0eec 100644 (file)
@@ -135,7 +135,7 @@ uptime()
    }
    savelocale = setlocale(LC_NUMERIC, NULL);
    setlocale(LC_NUMERIC,"C");
-   fscanf(file, "%s", buf);
+   if (fscanf(file, "%s", buf) == EOF) perror("uptime");
    fclose(file);
    setlocale(LC_NUMERIC,savelocale);
    return atof(buf);