[Asterisk-code-review] menuselect: exit non-zero in case of failure on --enable|disable opti... (asterisk[master])

Jaco Kroon asteriskteam at digium.com
Sat Mar 13 05:03:45 CST 2021


Jaco Kroon has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/15628 )


Change subject: menuselect: exit non-zero in case of failure on --enable|disable options.
......................................................................

menuselect: exit non-zero in case of failure on --enable|disable options.

Change-Id: I77e3466435f5a51a57538b29addb68d811af238d
Signed-off-by: Jaco Kroon <jaco at uls.co.za>
---
M menuselect/menuselect.c
1 file changed, 5 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/28/15628/1

diff --git a/menuselect/menuselect.c b/menuselect/menuselect.c
index 2eea3f0..adb6fa1 100644
--- a/menuselect/menuselect.c
+++ b/menuselect/menuselect.c
@@ -2090,6 +2090,7 @@
 		/* Reset options processing */
 		option_index = 0;
 		optind = 1;
+		res = 0;
 
 		while ((c = getopt_long(argc, argv, "", long_options, &option_index)) != -1) {
 			print_debug("Got option %c\n", c);
@@ -2100,6 +2101,7 @@
 						set_member_enabled(mem);
 					} else {
 						fprintf(stderr, "'%s' not found\n", optarg);
+						res = 1;
 					}
 				}
 				break;
@@ -2109,6 +2111,7 @@
 						set_all(cat, 1);
 					} else {
 						fprintf(stderr, "'%s' not found\n", optarg);
+						res = 1;
 					}
 				}
 				break;
@@ -2123,6 +2126,7 @@
 						clear_member_enabled(mem);
 					} else {
 						fprintf(stderr, "'%s' not found\n", optarg);
+						res = 1;
 					}
 				}
 				break;
@@ -2132,6 +2136,7 @@
 						set_all(cat, 0);
 					} else {
 						fprintf(stderr, "'%s' not found\n", optarg);
+						res = 1;
 					}
 				}
 				break;
@@ -2146,7 +2151,6 @@
 				break;
 			}
 		}
-		res = 0;
 	}
 
 	if (!res) {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15628
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I77e3466435f5a51a57538b29addb68d811af238d
Gerrit-Change-Number: 15628
Gerrit-PatchSet: 1
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210313/a41e2b81/attachment.html>


More information about the asterisk-code-review mailing list