summaryrefslogtreecommitdiff
path: root/netsniff-ng.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-08-19 09:06:03 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-08-19 09:06:03 +0200
commit1b554ed8277dd027db458a029dfbe90d04e212b6 (patch)
tree9a4c2515a8d7ee3af0d947f0fb8ff892b794dccc /netsniff-ng.c
parentc2887b312d229698d3c96505dc573c26d859b4c2 (diff)
netsniff-ng: poll: don't panic on EINTR
When signal occurs, don't panic on EINTR, rather gracefully return. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'netsniff-ng.c')
-rw-r--r--netsniff-ng.c12
1 files 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));