From d5d745f90b929310f3893bb8b3766cc1745140c8 Mon Sep 17 00:00:00 2001 From: Olivier Marin Date: Mon, 21 Jul 2008 20:30:36 +0200 Subject: parse-options: fix segmentation fault when a required value is missing p->argc represent the number of arguments that have not been parsed yet, _including_ the one we are currently parsing. If it is not greater than one then there is no more argument. Signed-off-by: Olivier Marin Acked-by: Pierre Habouzit Signed-off-by: Junio C Hamano --- t/t0040-parse-options.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't/t0040-parse-options.sh') diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index 6309aed451..03dbe00102 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -78,6 +78,13 @@ test_expect_success 'long options' ' test_cmp expect output ' +test_expect_success 'missing required value' ' + test-parse-options -s; + test $? = 129 && + test-parse-options --string; + test $? = 129 +' + cat > expect << EOF boolean: 1 integer: 13 -- cgit v1.2.1