summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-08-27 18:02:47 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-08-27 18:02:47 +0200
commit347761e2fc734e10f4394e4dbce95a54776c4cae (patch)
tree6466c9c6cda2246baa81aff0d912582d5e77427e
parent2674577a6f147298f777ce740808a7cf625d6736 (diff)
Switch to strtolHEADmaster
-rw-r--r--src/randsleep.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/randsleep.c b/src/randsleep.c
index bf7bdc3..23db7a7 100644
--- a/src/randsleep.c
+++ b/src/randsleep.c
@@ -5,13 +5,19 @@
int main (int argc, char **argv) {
long maxsleep;
+ char * strtol_err;
if (argc < 2) {
fputs("Usage: randsleep <max> [<cmd> [<args ...>]]\n", stderr);
return 1;
}
- maxsleep = atol(argv[1]);
+ maxsleep = strtol(argv[1], &strtol_err, 0);
+
+ if (strtol_err) {
+ printf("randsleep: strtol: Conversion error at '%s'\n", strtol_err);
+ return 1;
+ }
srand(time(NULL) + getpid());