diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-08-06 16:18:38 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-08-07 09:16:29 +0200 |
commit | 2c7558dc43741850353a9739e08b48b25216ae1a (patch) | |
tree | f7837f721c79604152e0abeec40a300bdcde03d5 /test/nstool.c | |
parent | b91bae1ded2822484085239eaba7823ac7434d69 (diff) | |
download | passt-2c7558dc43741850353a9739e08b48b25216ae1a.tar passt-2c7558dc43741850353a9739e08b48b25216ae1a.tar.gz passt-2c7558dc43741850353a9739e08b48b25216ae1a.tar.bz2 passt-2c7558dc43741850353a9739e08b48b25216ae1a.tar.lz passt-2c7558dc43741850353a9739e08b48b25216ae1a.tar.xz passt-2c7558dc43741850353a9739e08b48b25216ae1a.tar.zst passt-2c7558dc43741850353a9739e08b48b25216ae1a.zip |
log: Handle errors from clock_gettime()
clock_gettime() can, theoretically, fail, although it probably won't until
2038 on old 32-bit systems. Still, it's possible someone could run with
a wildly out of sync clock, or new errors could be added, or it could fail
due to a bug in libc or the kernel.
We don't handle this well. In the debug_print case in vlogmsg we'll just
ignore the failure, and print a timestamp based on uninitialised garbage.
In logfile_write() we exit early and won't log anything at all, which seems
like a good way to make an already weird situation undebuggable.
Add some helpers to instead handle this by using "<error>" in place of a
timestamp if something goes wrong with clock_gettime().
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/nstool.c')
0 files changed, 0 insertions, 0 deletions