Skip to contentSkip to conversation

ss: return -1 if an unrecognized option was given

PATCH Applied Phil Sutter 2 participants 2 messages Oct 15, 2015 – Oct 19, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---
 misc/ss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
misc/ss.c +1 -1
index eca4aa3..a9ae85e 100644
@@ -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
#1 lore raw
Quoted 5 lines · On Thu, 15 Oct 2015 21:01:16 +0200 Phil Sutter <[email protected]> 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.

Applied