The recent --help infrastructure fiddling made "toybox --help unknown" segfault

because lookup failure left this->which NULL and error_exit() dereferenced it.
(Oops.)
This commit is contained in:
Rob Landley 2016-10-17 18:32:35 -05:00
parent 3a6d317077
commit b2574799d1

1
main.c
View File

@ -70,6 +70,7 @@ static const int NEED_OPTIONS =
static void unknown(char *name) static void unknown(char *name)
{ {
toys.exitval = 127; toys.exitval = 127;
toys.which = toy_list;
error_exit("Unknown command %s", name); error_exit("Unknown command %s", name);
} }