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

Amitay Isaacs amitay at ozlabs.org
Thu May 24 15:50:14 AEST 2018


If a boolean function returns true on error, it's just recipe for all
sorts of programming errors.

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

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)) {
-- 
2.17.0



More information about the Pdbg mailing list