netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] ss: return -1 if an unrecognized option was given
@ 2015-10-15 19:01 Phil Sutter
  2015-10-19  4:45 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2015-10-15 19:01 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/ss.c b/misc/ss.c
index eca4aa3..a9ae85e 100644
--- 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();
 		}
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] ss: return -1 if an unrecognized option was given
  2015-10-15 19:01 [PATCH iproute2] ss: return -1 if an unrecognized option was given Phil Sutter
@ 2015-10-19  4:45 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2015-10-19  4:45 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netdev

On Thu, 15 Oct 2015 21:01:16 +0200
Phil Sutter <phil@nwl.cc> wrote:

> 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>

Applied

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-19  4:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-15 19:01 [PATCH iproute2] ss: return -1 if an unrecognized option was given Phil Sutter
2015-10-19  4:45 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).