Fix for PR bin/115033. This corrects a crash when long options

are specified with the "-W option=arg" syntax and the '=' is omitted.

MFC after: 3 days
Approved by: re (rwatson)
This commit is contained in:
Tim Kientzle 2007-08-01 03:15:35 +00:00
parent 85ce729794
commit 9b93c30d30
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171679

View File

@ -911,6 +911,10 @@ bsdtar_getopt(struct bsdtar *bsdtar, const char *optstring,
"(matches both %s and %s)",
p, (*poption)->name, option->name);
if ((*poption)->has_arg == required_argument
&& optarg == NULL)
bsdtar_errc(bsdtar, 1, 0,
"Option \"%s\" requires argument", p);
} else {
opt = '?';
/* TODO: Set up a fake 'struct option' for