From: Roy Marples Date: Wed, 5 Feb 2014 18:11:32 +0000 (+0000) Subject: Use fscanf some more. X-Git-Tag: v6.3.0~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efbb4489a005021da7f4ac9f4d9fb03b8938d643;p=thirdparty%2Fdhcpcd.git Use fscanf some more. --- diff --git a/platform-linux.c b/platform-linux.c index d8ae33b4..ff245b20 100644 --- a/platform-linux.c +++ b/platform-linux.c @@ -117,16 +117,15 @@ static int check_proc_int(const char *path) { FILE *fp; - char *buf; + int i; fp = fopen(path, "r"); if (fp == NULL) return -1; - buf = get_line(fp); + if (fscanf(fp, "%d", &i) != 1) + i = -1; fclose(fp); - if (buf == NULL) - return -1; - return atoi(buf); + return i; } static ssize_t