]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
flock: fix time_t=long assumptions
authorKarel Zak <kzak@redhat.com>
Thu, 6 May 2021 08:13:27 +0000 (10:13 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 6 May 2021 08:13:27 +0000 (10:13 +0200)
This also fixes flock for archs (e.g. sparc64) where suseconds_t is not long.

Fixes: https://github.com/karelzak/util-linux/issues/1069
References: http://github.com/karelzak/util-linux/commit/ce3355cc54d97711bc240783324f7ab51fd6e371
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/flock.c

index 670839c1d0d73dfd8e0d65527cdc0f6c57194ddd..6e93babf8284fa62498ed2b6fd616349f2a3cfb1 100644 (file)
@@ -331,9 +331,10 @@ int main(int argc, char *argv[])
 
                gettime_monotonic(&time_done);
                timersub(&time_done, &time_start, &delta);
-               printf(_("%s: getting lock took %ld.%06ld seconds\n"),
-                      program_invocation_short_name, delta.tv_sec,
-                      delta.tv_usec);
+               printf(_("%s: getting lock took %"PRId64".%06"PRId64" seconds\n"),
+                      program_invocation_short_name,
+                      (int64_t) delta.tv_sec,
+                      (int64_t) delta.tv_usec);
        }
        status = EX_OK;