Skip to contentSkip to conversation

Return error code in case of invalid command line option

PATCH Applied Vivek Goyal 2 participants 2 messages Sep 3, 2014 – Sep 4, 2014

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

PATCH 1/1 Return error code in case of invalid command line option

Currently kexec returns success even if an invalid command line option is encountered. Kexec currently prints usage message and then returns
0. That's not right. It is an error and error code 1 should be returned.

Due to this wrapper script thinks that kdump succeeded but that's not the case.

---
 kexec/kexec.c |    2 ++
 1 file changed, 2 insertions(+)
kexec/kexec.c +2 -0
Index: kexec-tools/kexec/kexec.c
===================================================================
@@ -1209,6 +1209,8 @@ int main(int argc, char *argv[])
 				  options, 0)) != -1) {
 		switch(opt) {
 		case '?':
+			usage();
+			return 1;
 		case OPT_HELP:
 			usage();
 			return 0;

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Applied
#1 lore raw
Quoted 8 lines · Vivek Goyal

Currently kexec returns success even if an invalid command line option is encountered. Kexec currently prints usage message and then returns
0. That's not right. It is an error and error code 1 should be returned.

Due to this wrapper script thinks that kdump succeeded but that's not the case.

Thanks, applied.

Quoted 10 lines
---
 kexec/kexec.c |    2 ++
 1 file changed, 2 insertions(+)

Index: kexec-tools/kexec/kexec.c
===================================================================

kexec/kexec.c int main(int argc, char *argv[]) · line 1216

Quoted 8 lines
kexec/kexec.c +2 -0
@@ -1209,6 +1209,8 @@ int main(int argc, char *argv[])
 				  options, 0)) != -1) {
 		switch(opt) {
 		case '?':
+			usage();
+			return 1;
 		case OPT_HELP:
 			usage();
 			return 0;

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec