X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Foping.c;h=caf655fd441197c46f2f39f544e711235e85fa6c;hb=7387822550ef3fc7ce41be58b858b2379f5b94dd;hp=79d7569db279b8a1d04eeb8b2ced4e3669179188;hpb=db412c89c4d3b899929d58d0eb44845cd029730a;p=liboping.git diff --git a/src/oping.c b/src/oping.c index 79d7569..caf655f 100644 --- a/src/oping.c +++ b/src/oping.c @@ -89,6 +89,10 @@ # define _POSIX_SAVED_IDS 0 #endif +#ifndef IPTOS_MINCOST +# define IPTOS_MINCOST 0x02 +#endif + /* Remove GNU specific __attribute__ settings when using another compiler */ #if !__GNUC__ # define __attribute__(x) /**/ @@ -1230,7 +1234,12 @@ int main (int argc, char **argv) /* {{{ */ return (1); } - if (ping_send (ping) < 0) + status = ping_send (ping); + if (status == -EINTR) + { + continue; + } + else if (status < 0) { fprintf (stderr, "ping_send failed: %s\n", ping_get_error (ping)); @@ -1263,14 +1272,13 @@ int main (int argc, char **argv) /* {{{ */ /* printf ("Sleeping for %i.%09li seconds\n", (int) ts_wait.tv_sec, ts_wait.tv_nsec); */ while ((status = nanosleep (&ts_wait, &ts_wait)) != 0) { - if (errno != EINTR) + if (errno == EINTR) { - perror ("nanosleep"); - break; + continue; } - else if (opt_count == 0) + else { - /* sigint */ + perror ("nanosleep"); break; } }