]> Savannah Git Hosting - gnulib.git/commitdiff
readutmp, boot-time: Fix parsing of /proc/uptime.
authorBruno Haible <bruno@clisp.org>
Sat, 12 Aug 2023 22:09:06 +0000 (00:09 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 12 Aug 2023 22:09:06 +0000 (00:09 +0200)
* lib/boot-time-aux.h (get_linux_uptime): Use c_strtod, not strtod.
* lib/readutmp.c: Include c-strtod.h.
* lib/boot-time.c: Likewise.
* modules/readutmp (Depends-on): Add c-strtod.
* modules/boot-time (Depends-on): Likewise.

ChangeLog
lib/boot-time-aux.h
lib/boot-time.c
lib/readutmp.c
modules/boot-time
modules/readutmp

index 3f47da62fbdb93aff3e37a9efaa98d4d9874064a..4330034fbe7ea050c8b75001d2a8b5d14ed88169 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-08-12  Bruno Haible  <bruno@clisp.org>
+
+       readutmp, boot-time: Fix parsing of /proc/uptime.
+       * lib/boot-time-aux.h (get_linux_uptime): Use c_strtod, not strtod.
+       * lib/readutmp.c: Include c-strtod.h.
+       * lib/boot-time.c: Likewise.
+       * modules/readutmp (Depends-on): Add c-strtod.
+       * modules/boot-time (Depends-on): Likewise.
+
 2023-08-12  Bruno Haible  <bruno@clisp.org>
 
        readutmp: On Linux, don't fail if /var/run/utmp is not accessible.
index e9f58e9d7e58a074c3d2b0ca41ca6596208fc34b..4c5474c6c8d4c9662ac34725abf60780a132e047 100644 (file)
@@ -48,7 +48,7 @@ get_linux_uptime (struct timespec *p_uptime)
           buf[n] = '\0';
           /* buf now contains two values: the uptime and the idle time.  */
           char *endptr;
-          double uptime = strtod (buf, &endptr);
+          double uptime = c_strtod (buf, &endptr);
           if (endptr > buf)
             {
               p_uptime->tv_sec = (time_t) uptime;
index d813bfa5825702f6ac249353b38c6831a216e11b..339ee8e938cb64b42c3392fbfbe49b7b96b0f6d6 100644 (file)
@@ -43,6 +43,7 @@
 # include <OS.h>
 #endif
 
+#include "c-strtod.h"
 #include "idx.h"
 #include "readutmp.h"
 #include "stat-time.h"
index ef9f0aff43415f02b79479158bd980b23cc0cc8d..6054511edfe0c3747d42b4587138b2c364662bd1 100644 (file)
@@ -51,6 +51,7 @@
 # include <OS.h>
 #endif
 
+#include "c-strtod.h"
 #include "stat-time.h"
 #include "xalloc.h"
 
index ba8a2b4e6f4e1b112ce1f04da66a3dae77a80db1..8890406d6c470a15fb5d97e730416c96c4f9076e 100644 (file)
@@ -9,6 +9,7 @@ lib/readutmp.h
 m4/readutmp.m4
 
 Depends-on:
+c-strtod
 extensions
 fopen-gnu
 idx
index 85bbf749545ce9c7c586609ca9ee410fdb8893e5..fcbc7ff149cb902e31e053d3b67fd7e625aa9f55 100644 (file)
@@ -9,6 +9,7 @@ m4/readutmp.m4
 m4/systemd.m4
 
 Depends-on:
+c-strtod
 extensions
 fopen-gnu
 idx