mirror of
https://passt.top/passt
synced 2025-05-22 17:25:35 +02:00
treewide: Address cert-err33-c clang-tidy warnings for clock and timer functions
For clock_gettime(), we shouldn't ignore errors if they happen at initialisation phase, because something is seriously wrong and it's not helpful if we proceed as if nothing happened. As we're up and running, though, it's probably better to report the error and use a stale value than to terminate altogether. Make sure we use a zero value if we don't have a stale one somewhere. For timerfd_gettime() and timerfd_settime() failures, just report an error, there isn't much else we can do. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
59fe34ee36
commit
099ace64ce
3 changed files with 26 additions and 12 deletions
9
passt.c
9
passt.c
|
@ -207,7 +207,8 @@ int main(int argc, char **argv)
|
|||
struct timespec now;
|
||||
struct sigaction sa;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &log_start);
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &log_start))
|
||||
die_perror("Failed to get CLOCK_MONOTONIC time");
|
||||
|
||||
arch_avx2_exec(argv);
|
||||
|
||||
|
@ -265,7 +266,8 @@ int main(int argc, char **argv)
|
|||
|
||||
secret_init(&c);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &now))
|
||||
die_perror("Failed to get CLOCK_MONOTONIC time");
|
||||
|
||||
flow_init();
|
||||
|
||||
|
@ -313,7 +315,8 @@ loop:
|
|||
if (nfds == -1 && errno != EINTR)
|
||||
die_perror("epoll_wait() failed in main loop");
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &now))
|
||||
err_perror("Failed to get CLOCK_MONOTONIC time");
|
||||
|
||||
for (i = 0; i < nfds; i++) {
|
||||
union epoll_ref ref = *((union epoll_ref *)&events[i].data.u64);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue