]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Replace get_line with sscanf
authorRoy Marples <roy@marples.name>
Wed, 5 Feb 2014 16:44:24 +0000 (16:44 +0000)
committerRoy Marples <roy@marples.name>
Wed, 5 Feb 2014 16:44:24 +0000 (16:44 +0000)
auth.c

diff --git a/auth.c b/auth.c
index 0cfd95af58b52180b17e380f12050587216dc5e9..f7d546e1ffa72722ac3937eed4e4c83c8ceaf29f 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -374,7 +374,6 @@ static uint64_t
 get_next_rdm_monotonic_counter(void)
 {
        FILE *fp;
-       char *line, *ep;
        uint64_t rdm;
        int flocked;
 
@@ -389,13 +388,8 @@ get_next_rdm_monotonic_counter(void)
                rdm = 0;
        } else {
                flocked = flock(fileno(fp), LOCK_EX);
-               line = get_line(fp);
-               if (line == NULL)
+               if (fscanf(fp, "0x%016" PRIu64, &rdm) != 1)
                        rdm = 0; /* truncated? report error? */
-               else {
-                       rdm = strtoull(line, &ep, 0);
-                       free(line);
-               }
        }
 
        rdm++;