[PATCH 5/5] tools: Fix return value on error in ocbr

  • From: Dimitri Staessens <dimitri@ouroboros.rocks>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Fri, 25 Feb 2022 00:15:32 +0100

The ocbr tool was returning 0 on error.

Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
---
 src/tools/ocbr/ocbr.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/tools/ocbr/ocbr.c b/src/tools/ocbr/ocbr.c
index 2643b588..1d52cc1a 100644
--- a/src/tools/ocbr/ocbr.c
+++ b/src/tools/ocbr/ocbr.c
@@ -155,17 +155,22 @@ int main(int argc, char ** argv)
                 if (s_apn == NULL) {
                         printf("No server specified.\n");
                         usage();
-                        return 0;
+                        return 1;
                 }
 
                 if (size > BUF_SIZE) {
                         printf("Maximum size: %ld.\n", BUF_SIZE);
-                        return 0;
+                        return 1;
                 }
 
                 if (size < 0) {
                         printf("Size overflow.\n");
-                        return 0;
+                        return 1;
+                }
+
+                if (rate <= 0) {
+                        printf("Invalid rate.\n");
+                        return 1;
                 }
 
                 ret = client_main(s_apn, duration, size, rate, flood, sleep);
-- 
2.35.1


Other related posts:

  • » [PATCH 5/5] tools: Fix return value on error in ocbr - Dimitri Staessens