From: Florian Forster Date: Fri, 13 Feb 2015 13:07:36 +0000 (+0100) Subject: src/oping.c: Code style fixes. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=74470ba8b82bfb49a318c1d7fa9c86f63a8d1706;p=liboping.git src/oping.c: Code style fixes. --- diff --git a/src/oping.c b/src/oping.c index 6263a4d..53602d3 100644 --- a/src/oping.c +++ b/src/oping.c @@ -1762,19 +1762,20 @@ int main (int argc, char **argv) /* {{{ */ } } - if(opt_mark != NULL) + if (opt_mark != NULL) { - char *endp; - int mark = strtoul(opt_mark, &endp, 0); - if(opt_mark[0] != '\0' && *endp == '\0') + char *endp = NULL; + int mark = (int) strtol (opt_mark, &endp, /* base = */ 0); + if ((opt_mark[0] != 0) && (endp != NULL) && (*endp == 0)) { - if(ping_setopt(ping, PING_OPT_MARK, (void*)(&mark)) != 0) + if (ping_setopt(ping, PING_OPT_MARK, (void*)(&mark)) != 0) { fprintf (stderr, "Setting mark failed: %s\n", ping_get_error (ping)); } } - else{ + else + { fprintf(stderr, "Ignoring invalid mark: %s\n", optarg); } }