ss: return -1 if an unrecognized option was given

When getopt_long encounters an option which has not been registered, it
returns '?'. React upon that and call usage() instead of help() so ss
returns with a non-zero exit status.

Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
Phil Sutter 2015-10-15 21:01:16 +02:00 committed by Stephen Hemminger
parent 6f07f3dc41
commit f73105ab42
1 changed files with 1 additions and 1 deletions

View File

@ -3770,8 +3770,8 @@ int main(int argc, char *argv[])
exit(1);
break;
case 'h':
case '?':
help();
case '?':
default:
usage();
}