summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b9bc9ce)
raw | patch | inline | side by side (parent: b9bc9ce)
author | Florian Forster <ff@octo.it> | |
Fri, 13 Feb 2015 13:07:36 +0000 (14:07 +0100) | ||
committer | Florian Forster <ff@octo.it> | |
Fri, 13 Feb 2015 13:07:36 +0000 (14:07 +0100) |
src/oping.c | patch | blob | history |
diff --git a/src/oping.c b/src/oping.c
index 6263a4def36459c7d94c8dbbb362cc89b56a9f6e..53602d3c53feeb87cdd2682c3748ba4133e3a248 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
}
}
- 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);
}
}