projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use utils_parse_time_suffix in create and enable-channel command
[lttng-tools.git]
/
src
/
bin
/
lttng
/
commands
/
create.c
diff --git
a/src/bin/lttng/commands/create.c
b/src/bin/lttng/commands/create.c
index faf9f3e0d780274d2beb69ab838d2302e4713dcd..60ca1f5d45fc7e0b6271f022b382d9ff8ce9a162 100644
(file)
--- a/
src/bin/lttng/commands/create.c
+++ b/
src/bin/lttng/commands/create.c
@@
-49,7
+49,7
@@
static char *opt_shm_path;
static int opt_no_consumer;
static int opt_no_output;
static int opt_snapshot;
static int opt_no_consumer;
static int opt_no_output;
static int opt_snapshot;
-static u
nsigned in
t opt_live_timer;
+static u
int32_
t opt_live_timer;
#ifdef LTTNG_EMBED_HELP
static const char help_msg[] =
#ifdef LTTNG_EMBED_HELP
static const char help_msg[] =
@@
-641,7
+641,7
@@
int cmd_create(int argc, const char **argv)
goto end;
case OPT_LIVE_TIMER:
{
goto end;
case OPT_LIVE_TIMER:
{
- u
nsigned long
v;
+ u
int64_t
v;
errno = 0;
opt_arg = poptGetOptArg(pc);
errno = 0;
opt_arg = poptGetOptArg(pc);
@@
-653,22
+653,24
@@
int cmd_create(int argc, const char **argv)
break;
}
break;
}
- v = strtoul(opt_arg, NULL, 0);
- if (errno != 0 || !isdigit(opt_arg[0])) {
- ERR("Wrong value in --live parameter: %s", opt_arg);
+ if (utils_parse_time_suffix(opt_arg, &v) < 0) {
+ ERR("Wrong value for --live parameter: %s", opt_arg);
ret = CMD_ERROR;
goto end;
}
ret = CMD_ERROR;
goto end;
}
+
if (v != (uint32_t) v) {
ERR("32-bit overflow in --live parameter: %s", opt_arg);
ret = CMD_ERROR;
goto end;
}
if (v != (uint32_t) v) {
ERR("32-bit overflow in --live parameter: %s", opt_arg);
ret = CMD_ERROR;
goto end;
}
+
if (v == 0) {
ERR("Live timer interval must be greater than zero");
ret = CMD_ERROR;
goto end;
}
if (v == 0) {
ERR("Live timer interval must be greater than zero");
ret = CMD_ERROR;
goto end;
}
+
opt_live_timer = (uint32_t) v;
DBG("Session live timer interval set to %d", opt_live_timer);
break;
opt_live_timer = (uint32_t) v;
DBG("Session live timer interval set to %d", opt_live_timer);
break;
This page took
0.025188 seconds
and
4
git commands to generate.