diff --git a/README.md b/README.md index 0c49ef5..f70ad18 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Build Status](https://travis-ci.org/schweikert/fping.svg?branch=develop)](https://travis-ci.org/schweikert/fping) [![Coverage Status](https://coveralls.io/repos/schweikert/fping/badge.svg?branch=develop&service=github)](https://coveralls.io/github/schweikert/fping?branch=develop) +[![Coverity Scan Build Status](https://scan.coverity.com/projects/11559/badge.svg?flat=1")](https://scan.coverity.com/projects/schweikert-fping) # fping 3 diff --git a/ci/build-2-install.sh b/ci/build-2-install.sh index a019b12..2eb7ccc 100755 --- a/ci/build-2-install.sh +++ b/ci/build-2-install.sh @@ -11,7 +11,7 @@ fi autoreconf -i ./configure --enable-ipv4 --enable-ipv6 --prefix=/opt/fping make CFLAGS="-g -fprofile-arcs -ftest-coverage" -## setcap currently doesn't worn anymore on travis-ci +## setcap currently doesn't work anymore on travis-ci #sudo setcap cap_net_raw+ep src/fping #sudo setcap cap_net_raw+ep src/fping6 ## setcap debugging: diff --git a/ci/deploy-bintray.sh b/ci/deploy-bintray.sh index 95219a3..dcb53d1 100755 --- a/ci/deploy-bintray.sh +++ b/ci/deploy-bintray.sh @@ -10,9 +10,9 @@ set -e # exit 0 #fi -# do this only for the master and version3 branch -if [ "$TRAVIS_BRANCH" != "master" -a "$TRAVIS_BRANCH" != "version3" ]; then - echo "skipped upload branch $TRAVIS_BRANCH isn't master/version3" +# do this only for the master branch +if [ "$TRAVIS_BRANCH" != "master" ]; then + echo "skipped upload branch $TRAVIS_BRANCH isn't master" exit 0 fi diff --git a/ci/test-01-basics.pl b/ci/test-01-basics.pl index 3119232..15fc5f8 100755 --- a/ci/test-01-basics.pl +++ b/ci/test-01-basics.pl @@ -13,7 +13,7 @@ use Test::More; # ping ::1 SKIP: { - system("/sbin/ifconfig >&2"); + #system("/sbin/ifconfig >&2"); if(system("/sbin/ifconfig | grep inet6") != 0) { skip 'No IPv6 on this host', 3; } diff --git a/src/fping.c b/src/fping.c index c0a1a33..0b958e9 100644 --- a/src/fping.c +++ b/src/fping.c @@ -430,7 +430,7 @@ int main(int argc, char** argv) break; case 'b': - if (!sscanf(optarg, "%i", &ping_data_size)) + if (!sscanf(optarg, "%u", &ping_data_size)) usage(1); break; @@ -580,7 +580,6 @@ int main(int argc, char** argv) fprintf(stderr, "see 'fping -h' for usage information\n"); exit(1); break; - } } @@ -600,7 +599,6 @@ int main(int argc, char** argv) if (count_flag && loop_flag) { fprintf(stderr, "%s: specify only one of c, l\n", argv[0]); exit(1); - } if ((interval < MIN_INTERVAL * 100 || perhost_interval < MIN_PERHOST_INTERVAL * 100) @@ -615,14 +613,12 @@ int main(int argc, char** argv) fprintf(stderr, "%s: data size %u not valid, must be lower than %u\n", prog, ping_data_size, (unsigned int)MAX_PING_DATA); exit(1); - } if ((backoff > MAX_BACKOFF_FACTOR) || (backoff < MIN_BACKOFF_FACTOR)) { fprintf(stderr, "%s: backoff factor %.1f not valid, must be between %.1f and %.1f\n", prog, backoff, MIN_BACKOFF_FACTOR, MAX_BACKOFF_FACTOR); exit(1); - } if (alive_flag || unreachable_flag) @@ -633,7 +629,6 @@ int main(int argc, char** argv) per_recv_flag = 1; alive_flag = unreachable_flag = verbose_flag = 0; - } if (loop_flag) { @@ -641,7 +636,6 @@ int main(int argc, char** argv) per_recv_flag = 1; alive_flag = unreachable_flag = verbose_flag = 0; - } trials = (count > retry + 1) ? count : retry + 1; @@ -656,13 +650,11 @@ int main(int argc, char** argv) if (debugging & DBG_RANDOM_LOSE_FEW) { randomly_lose_flag = 1; lose_factor = 1; /* ie, 1/4 */ - } if (debugging & DBG_RANDOM_LOSE_MANY) { randomly_lose_flag = 1; lose_factor = 5; /* ie, 3/4 */ - } if (debugging & DBG_PRINT_PER_SYSTEM) @@ -717,7 +709,6 @@ int main(int argc, char** argv) fprintf(stderr, " outage_flag set\n"); if (netdata_flag) fprintf(stderr, " netdata_flag set\n"); - } #endif /* DEBUG || _DEBUG */ @@ -978,19 +969,18 @@ void add_range(char* start, char* end) end_long = ntohl(((struct sockaddr_in *) addr_res->ai_addr)->sin_addr.s_addr); freeaddrinfo(addr_res); - if(end_long - start_long > MAX_GENERATE) { - fprintf(stderr, "Error: -g parameter generates too many addresses\n"); - exit(1); + if (end_long > start_long + MAX_GENERATE) { + fprintf(stderr, "%s: -g parameter generates too many addresses\n", prog); + exit(1); } /* generate */ - while (start_long <= end_long) { + for (; start_long <= end_long; start_long++) { struct in_addr in_addr_tmp; char buffer[20]; in_addr_tmp.s_addr = htonl(start_long); inet_ntop(AF_INET, &in_addr_tmp, buffer, sizeof(buffer)); add_name(buffer); - start_long++; } } @@ -1065,7 +1055,7 @@ void main_loop() } } - wait_for_reply: + wait_for_reply: /* When can we expect the next event? */ if (ev_first) { @@ -1823,7 +1813,6 @@ int wait_for_reply(long wait_time) } printf("\n"); - } } @@ -1864,7 +1853,6 @@ int wait_for_reply(long wait_time) fflush(stdout); return num_jobs; - } /************************************************************