If an argument is there, but it can't be parsed as a non-positive
number, then die() rather than returning 0.
Signed-off-by: Michael Haggerty <redacted>
---
diff.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/diff.c b/diff.c
index 77c7acb..03cdabf 100644
--- a/diff.c
+++ b/diff.c
@@ -3368,7 +3368,7 @@ static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *va
if (!c)
return 1; /* optional argument was missing */
if (convert_i(arg, 10, val))
- return 0;
+ die("The value for -%c must be a non-negative integer", arg_short);
return 1;
}
if (c != '-')@@ -3381,7 +3381,7 @@ static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *va
if (!*eq)
return 1; /* '=' and optional argument were missing */
if (convert_i(eq + 1, 10, val))
- return 0;
+ die("The value for --%s must be a non-negative integer", arg_long);
return 1;
}
--
2.1.4