diff mbox series

[v3,08/11] main: Return false on failure

Message ID 20180524055017.8801-9-amitay@ozlabs.org
State Accepted
Headers show
Series Some more cleanups | expand

Commit Message

Amitay Isaacs May 24, 2018, 5:50 a.m. UTC
If a boolean function returns true on error, it's just recipe for all
sorts of programming errors.

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 src/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/main.c b/src/main.c
index 4e0ed16..7540b9b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -295,7 +295,7 @@  static bool parse_options(int argc, char *argv[])
 	if (opt_error)
 		print_usage(argv[0]);
 
-	return opt_error;
+	return !opt_error;
 }
 
 void target_select(struct pdbg_target *target)
@@ -594,7 +594,7 @@  int main(int argc, char *argv[])
 	backend = default_backend();
 	device_node = default_target(backend);
 
-	if (parse_options(argc, argv))
+	if (!parse_options(argc, argv))
 		return 1;
 
 	if (!backend_is_possible(backend)) {