X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Foping.c;h=b3beeb09d52b363fca4727d88bbb29dc76d4d3d7;hb=4710e5477bfa3902b5f5600475ea21c44fabf446;hp=5c0ead5ee2608f4b69a3da6b59041e278321d7ff;hpb=6c682f99f7b995e1c155ab2627687cece54dbfbc;p=liboping.git diff --git a/src/oping.c b/src/oping.c index 5c0ead5..b3beeb0 100644 --- a/src/oping.c +++ b/src/oping.c @@ -128,6 +128,10 @@ static size_t const hist_colors_num = sizeof (hist_colors_utf8) # 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) /**/ @@ -1402,7 +1406,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)); @@ -1435,14 +1444,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; } }