projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
port: fix -Wdeprecated-declarations warning about sprintf on macOS clang 14
[lttng-tools.git]
/
tests
/
regression
/
tools
/
notification
/
base_client.c
diff --git
a/tests/regression/tools/notification/base_client.c
b/tests/regression/tools/notification/base_client.c
index ae150500eb99911e110341903bbeba3b13efe75e..b7e1a9f42f8eef81fa0be4ef55d924eec30c3034 100644
(file)
--- a/
tests/regression/tools/notification/base_client.c
+++ b/
tests/regression/tools/notification/base_client.c
@@
-14,10
+14,9
@@
#include <string.h>
#include <unistd.h>
#include <inttypes.h>
#include <string.h>
#include <unistd.h>
#include <inttypes.h>
-#include <assert.h>
#include <lttng/action/action.h>
#include <lttng/action/action.h>
-#include <lttng/action/
group
.h>
+#include <lttng/action/
list
.h>
#include <lttng/action/notify.h>
#include <lttng/condition/buffer-usage.h>
#include <lttng/condition/condition.h>
#include <lttng/action/notify.h>
#include <lttng/condition/buffer-usage.h>
#include <lttng/condition/condition.h>
@@
-92,12
+91,24
@@
int parse_arguments(char **argv)
/* Ratio or bytes ? */
if (!strcasecmp("bytes", buffer_usage_threshold_type)) {
is_threshold_ratio = false;
/* 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;
}
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 */
}
/* Number of notification to expect */
@@
-129,6
+140,7
@@
int main(int argc, char **argv)
struct lttng_condition *condition = NULL;
struct lttng_action *action = NULL;
struct lttng_trigger *trigger = NULL;
struct lttng_condition *condition = NULL;
struct lttng_action *action = NULL;
struct lttng_trigger *trigger = NULL;
+ enum lttng_error_code ret_code;
/*
* Disable buffering on stdout.
/*
* Disable buffering on stdout.
@@
-257,14
+269,14
@@
int main(int argc, char **argv)
goto end;
}
goto end;
}
- ret
= lttng_register_trigger
(trigger);
+ ret
_code = lttng_register_trigger_with_automatic_name
(trigger);
/*
* An equivalent trigger might already be registered if an other app
* registered an equivalent trigger.
*/
/*
* An equivalent trigger might already be registered if an other app
* registered an equivalent trigger.
*/
- if (ret
< 0 && ret != -
LTTNG_ERR_TRIGGER_EXISTS) {
- printf("error: %s\n", lttng_strerror(
ret
));
+ if (ret
_code != LTTNG_OK && ret_code !=
LTTNG_ERR_TRIGGER_EXISTS) {
+ printf("error: %s\n", lttng_strerror(
-ret_code
));
ret = 1;
goto end;
}
ret = 1;
goto end;
}
This page took
0.024442 seconds
and
4
git commands to generate.