summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-12-10 16:34:30 -0800
committerGuy Harris <guy@alum.mit.edu>2013-12-10 16:34:30 -0800
commit790144e44709c7d3fa5790ae35dd1e01a6516269 (patch)
tree6de8d33ecb681d2d6f6b987652653b50df10e18e /tests
parent0baaa40cec03301940fbb48ee8788973e2b4e58c (diff)
downloadlibpcap-790144e44709c7d3fa5790ae35dd1e01a6516269.tar.gz
Clean up some error messages.
Diffstat (limited to 'tests')
-rw-r--r--tests/capturetest.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/capturetest.c b/tests/capturetest.c
index 6999b224..abe7dd3e 100644
--- a/tests/capturetest.c
+++ b/tests/capturetest.c
@@ -87,12 +87,20 @@ main(int argc, char **argv)
case 't':
longarg = strtol(optarg, &p, 10);
- if (p == optarg || *p != '\0')
- error("Invalid timeout \"%s\"", optarg);
- if (longarg < 0)
- error("Negative timeout %ld", longarg);
- if (longarg > INT_MAX)
- error("Too-large timeout %ld", longarg);
+ if (p == optarg || *p != '\0') {
+ error("Timeout value \"%s\" is not a number",
+ optarg);
+ /* NOTREACHED */
+ }
+ if (longarg < 0) {
+ error("Timeout value %ld is negative", longarg);
+ /* NOTREACHED */
+ }
+ if (longarg > INT_MAX) {
+ error("Timeout value %ld is too large (> %d)",
+ longarg, INT_MAX);
+ /* NOTREACHED */
+ }
timeout = (int)longarg;
break;