From 5e0895981b46ca575e288c81a0b0aca34714e5d8 Mon Sep 17 00:00:00 2001 From: Oliver Hartkopp Date: Mon, 7 Mar 2022 10:18:21 +0100 Subject: [PATCH] candump: fix accidentally disabled traffic timeout feature With the option '-T ' candump terminates after getting no CAN traffic for a specific time. With the introduction of epoll_wait() this feature has been accidentally disabled. This patch adds an extra check to detect the timeout again. Fixes: 639498bc801a ("candump: use epoll_wait() instead of select()") Signed-off-by: Oliver Hartkopp --- candump.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/candump.c b/candump.c index 4bad853..eaa3c2f 100644 --- a/candump.c +++ b/candump.c @@ -708,6 +708,12 @@ int main(int argc, char **argv) continue; } + /* handle timeout */ + if (!num_events && timeout_ms >= 0) { + running = 0; + continue; + } + for (i = 0; i < num_events; i++) { /* check waiting CAN RAW sockets */ struct if_info* obj = events_pending[i].data.ptr; int idx;