summaryrefslogtreecommitdiff
path: root/parse-options-cb.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-30 10:50:44 -0700
committerJunio C Hamano <gitster@pobox.com>2019-05-30 10:50:44 -0700
commit20aa7c594fbc2e36476daae2f53d7c020306c62c (patch)
tree16594455c941e4bc0002e32a624d27a29b0caeed /parse-options-cb.c
parentaa25c82427ae70aebf3b8f970f2afd54e9a2a8c6 (diff)
parentf7e68a08780e91d7c2f830f33457041407172b96 (diff)
downloadgit-20aa7c594fbc2e36476daae2f53d7c020306c62c.tar.gz
Merge branch 'nd/diff-parseopt'
A brown-paper-bag bugfix to a change already in 'master'. * nd/diff-parseopt: parse-options: check empty value in OPT_INTEGER and OPT_ABBREV diff-parseopt: restore -U (no argument) behavior diff-parseopt: correct variable types that are used by parseopt
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r--parse-options-cb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c
index 4b95d04a37..a3de795c58 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -16,6 +16,9 @@ int parse_opt_abbrev_cb(const struct option *opt, const char *arg, int unset)
if (!arg) {
v = unset ? 0 : DEFAULT_ABBREV;
} else {
+ if (!*arg)
+ return error(_("option `%s' expects a numerical value"),
+ opt->long_name);
v = strtol(arg, (char **)&arg, 10);
if (*arg)
return error(_("option `%s' expects a numerical value"),