diff mbox

[iproute2] ss: return -1 if an unrecognized option was given

Message ID 1444935676-10068-1-git-send-email-phil@nwl.cc
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Phil Sutter Oct. 15, 2015, 7:01 p.m. UTC
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(-)

Comments

stephen hemminger Oct. 19, 2015, 4:45 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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();
 		}