Force usage of assert() condition when NDEBUG is defined
[lttng-tools.git] / tests / regression / tools / notification / base_client.c
index eecdb47885a5520d8a502241ab0a21979af652ca..b7e1a9f42f8eef81fa0be4ef55d924eec30c3034 100644 (file)
@@ -14,7 +14,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <assert.h>
 
 #include <lttng/action/action.h>
 #include <lttng/action/list.h>
@@ -92,12 +91,24 @@ int parse_arguments(char **argv)
        /* Ratio or bytes ? */
        if (!strcasecmp("bytes", buffer_usage_threshold_type)) {
                is_threshold_ratio = false;
-               sscanf(buffer_usage_threshold_value, "%" SCNu64, &threshold_bytes);
+               sscanf_ret = sscanf(buffer_usage_threshold_value, "%" SCNu64,
+                               &threshold_bytes);
+               if (sscanf_ret != 1) {
+                       printf("error: Invalid buffer usage threshold value bytes (integer), sscanf returned %d\n",
+                                       sscanf_ret);
+                       goto error;
+               }
        }
 
        if (!strcasecmp("ratio", buffer_usage_threshold_type)) {
                is_threshold_ratio = true;
-               sscanf(buffer_usage_threshold_value, "%lf", &threshold_ratio);
+               sscanf_ret = sscanf(buffer_usage_threshold_value, "%lf",
+                               &threshold_ratio);
+               if (sscanf_ret != 1) {
+                       printf("error: Invalid buffer usage threshold value ratio (float), sscanf returned %d\n",
+                                       sscanf_ret);
+                       goto error;
+               }
        }
 
        /* Number of notification to expect */
This page took 0.023502 seconds and 4 git commands to generate.