aboutsummaryrefslogtreecommitdiff
path: root/t/helper/test-genrandom.c
diff options
context:
space:
mode:
Diffstat (limited to 't/helper/test-genrandom.c')
-rw-r--r--t/helper/test-genrandom.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/t/helper/test-genrandom.c b/t/helper/test-genrandom.c
index 51b67f2f87..d681961abb 100644
--- a/t/helper/test-genrandom.c
+++ b/t/helper/test-genrandom.c
@@ -6,6 +6,7 @@
#include "test-tool.h"
#include "git-compat-util.h"
+#include "parse.h"
int cmd__genrandom(int argc, const char **argv)
{
@@ -22,7 +23,9 @@ int cmd__genrandom(int argc, const char **argv)
next = next * 11 + *c;
} while (*c++);
- count = (argc == 3) ? strtoul(argv[2], NULL, 0) : ULONG_MAX;
+ count = ULONG_MAX;
+ if (argc == 3 && !git_parse_ulong(argv[2], &count))
+ return error_errno("cannot parse argument '%s'", argv[2]);
while (count--) {
next = next * 1103515245 + 12345;