]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ss: return -1 if an unrecognized option was given
authorPhil Sutter <phil@nwl.cc>
Thu, 15 Oct 2015 19:01:16 +0000 (21:01 +0200)
committerStephen Hemminger <shemming@brocade.com>
Mon, 19 Oct 2015 04:56:55 +0000 (21:56 -0700)
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>
misc/ss.c

index eca4aa35facc04e3f8e2897516fc22d42ef8dad3..a9ae85ec564e9b4a1371d650eda2cbdd7cb0f460 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -3770,8 +3770,8 @@ int main(int argc, char *argv[])
                                exit(1);
                        break;
                case 'h':
-               case '?':
                        help();
+               case '?':
                default:
                        usage();
                }