From 0101affb68420913ef3f5e0b4525382f8a704c45 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Mon, 28 Dec 2020 22:54:04 +0100 Subject: [PATCH] unix: fix uv_uptime() regression As it was in the original version of https://github.com/libuv/libuv/pull/3072, `%lf` must be used in `sscanf()` as the value is being stored in a `double` and not a `float`. PR-URL: https://github.com/libuv/libuv/pull/3080 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- src/unix/linux-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/linux-core.c b/src/unix/linux-core.c index 3d2d4cf7..c356e96d 100644 --- a/src/unix/linux-core.c +++ b/src/unix/linux-core.c @@ -636,7 +636,7 @@ int uv_uptime(double* uptime) { /* Try /proc/uptime first, then fallback to clock_gettime(). */ if (0 == uv__slurp("/proc/uptime", buf, sizeof(buf))) - if (1 == sscanf(buf, "%f", uptime)) + if (1 == sscanf(buf, "%lf", uptime)) return 0; /* Try CLOCK_BOOTTIME first, fall back to CLOCK_MONOTONIC if not available