ss: return -1 if an unrecognized option was given
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- misc/ss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
misc/ss.c +1 -1
@@ -3770,8 +3770,8 @@ int main(int argc, char *argv[])exit (1 );break ;case 'h' : -case '?' :help (); +case '?' :default :usage (); }
Signature · 1 line
2.5.0
Stephen Hemminger
AppliedQuoted 5 lines · On Thu, 15 Oct 2015 21:01:16 +0200 Phil Sutter <[email protected]> wrote:
When
getopt_longencounters an option which has not been registered, it returns '?'. React upon that and callusage()instead ofhelp()so ss returns with a non-zero exit status.Signed-off-by Phil Sutter <[email protected]>
Applied