Fix top(1) long options handling

getopt_long(3) requires the long options be terminated by a NULL block.
Without the terminator, an invalid long option results in a segmentation
fault.

Reported by:	Brandon Bergren
MFC after:	1 week
This commit is contained in:
Justin Hibbits 2019-01-18 23:26:31 +00:00
parent be659d72bb
commit 61ef814f56
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343165

View File

@ -110,7 +110,8 @@ static const struct option longopts[] = {
{ "uids", no_argument, NULL, 'u' },
{ "version", no_argument, NULL, 'v' },
{ "swap", no_argument, NULL, 'w' },
{ "system-idle-procs", no_argument, NULL, 'z' }
{ "system-idle-procs", no_argument, NULL, 'z' },
{ NULL, 0, NULL, 0 }
};
static void