From 1b554ed8277dd027db458a029dfbe90d04e212b6 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Mon, 19 Aug 2013 09:06:03 +0200 Subject: netsniff-ng: poll: don't panic on EINTR When signal occurs, don't panic on EINTR, rather gracefully return. Signed-off-by: Daniel Borkmann --- netsniff-ng.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/netsniff-ng.c b/netsniff-ng.c index 682fb39..331e476 100644 --- a/netsniff-ng.c +++ b/netsniff-ng.c @@ -474,8 +474,10 @@ static void receive_to_xmit(struct ctx *ctx) } ret = poll(&rx_poll, 1, -1); - if (unlikely(ret < 0)) - panic("Poll failed!\n"); + if (unlikely(ret < 0)) { + if (errno != EINTR) + panic("Poll failed!\n"); + } } out: @@ -985,8 +987,10 @@ static void recv_only_or_dump(struct ctx *ctx) } ret = poll(&rx_poll, 1, -1); - if (unlikely(ret < 0)) - panic("Poll failed!\n"); + if (unlikely(ret < 0)) { + if (errno != EINTR) + panic("Poll failed!\n"); + } } bug_on(gettimeofday(&end, NULL)); -- cgit v1.2.3-54-g00ecf