diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-12-10 16:34:30 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-12-10 16:34:30 -0800 |
commit | 790144e44709c7d3fa5790ae35dd1e01a6516269 (patch) | |
tree | 6de8d33ecb681d2d6f6b987652653b50df10e18e /tests | |
parent | 0baaa40cec03301940fbb48ee8788973e2b4e58c (diff) | |
download | libpcap-790144e44709c7d3fa5790ae35dd1e01a6516269.tar.gz |
Clean up some error messages.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/capturetest.c | 20 |
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; |