diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2014-04-28 15:25:35 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2014-04-28 15:25:35 +0000 |
commit | 01902b13133bd45eaa86e59d8e92aef02da28a3a (patch) | |
tree | 85c46d6cea47664d69095429361bc6d992168d03 /sbin/ping/ping.c | |
parent | a130f4a7beb3c01b4333e994c59556a8dda5e14a (diff) |
Do not sleep after poll returning an error. Blindly copied over from
ping6 to ping by me without thinking clearly.
pointed out by deraadt@
OK jca@
Diffstat (limited to 'sbin/ping/ping.c')
-rw-r--r-- | sbin/ping/ping.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 7a02f7fa9d1..314ac4c3c57 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.102 2014/04/23 18:16:36 jca Exp $ */ +/* $OpenBSD: ping.c,v 1.103 2014/04/28 15:25:34 florian Exp $ */ /* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */ /* @@ -511,7 +511,7 @@ main(int argc, char *argv[]) socklen_t fromlen; struct pollfd pfd; ssize_t cc; - int ret, timeout; + int timeout; if (options & F_FLOOD) { pinger(); @@ -522,14 +522,7 @@ main(int argc, char *argv[]) pfd.fd = s; pfd.events = POLLIN; - ret = poll(&pfd, 1, timeout); - if (ret < 0) { - if (errno != EINTR) { - warn("poll"); - sleep(1); - } - continue; - } else if (ret == 0) + if (poll(&pfd, 1, timeout) <= 0) continue; fromlen = sizeof(from); |