]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Use fscanf some more.
authorRoy Marples <roy@marples.name>
Wed, 5 Feb 2014 18:11:32 +0000 (18:11 +0000)
committerRoy Marples <roy@marples.name>
Wed, 5 Feb 2014 18:11:32 +0000 (18:11 +0000)
platform-linux.c

index d8ae33b47b6a9287ff54100784554a2fa41c5d68..ff245b2069a1c39c43f8f7c2253ba145b24571de 100644 (file)
@@ -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