summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7010c03)
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
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 unsigned int opt_live_timer;
+static uint32_t opt_live_timer;
#ifdef LTTNG_EMBED_HELP
static const char help_msg[] =
#ifdef LTTNG_EMBED_HELP
static const char help_msg[] =
goto end;
case OPT_LIVE_TIMER:
{
goto end;
case OPT_LIVE_TIMER:
{
errno = 0;
opt_arg = poptGetOptArg(pc);
errno = 0;
opt_arg = poptGetOptArg(pc);
- 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;
}
case OPT_SWITCH_TIMER:
{
}
case OPT_SWITCH_TIMER:
{
errno = 0;
opt_arg = poptGetOptArg(pc);
errno = 0;
opt_arg = poptGetOptArg(pc);
- v = strtoul(opt_arg, NULL, 0);
- if (errno != 0 || !isdigit(opt_arg[0])) {
- ERR("Wrong value in --switch-timer parameter: %s", opt_arg);
+
+ if (utils_parse_time_suffix(opt_arg, &v) < 0) {
+ ERR("Wrong value for --switch-timer parameter: %s", opt_arg);
ret = CMD_ERROR;
goto end;
}
ret = CMD_ERROR;
goto end;
}
if (v != (uint32_t) v) {
ERR("32-bit overflow in --switch-timer parameter: %s", opt_arg);
ret = CMD_ERROR;
if (v != (uint32_t) v) {
ERR("32-bit overflow in --switch-timer parameter: %s", opt_arg);
ret = CMD_ERROR;
errno = 0;
opt_arg = poptGetOptArg(pc);
errno = 0;
opt_arg = poptGetOptArg(pc);
- v = strtoul(opt_arg, NULL, 0);
- if (errno != 0 || !isdigit(opt_arg[0])) {
- ERR("Wrong value in --read-timer parameter: %s", opt_arg);
+
+ if (utils_parse_time_suffix(opt_arg, &v) < 0) {
+ ERR("Wrong value for --read-timer parameter: %s", opt_arg);
ret = CMD_ERROR;
goto end;
}
ret = CMD_ERROR;
goto end;
}
if (v != (uint32_t) v) {
ERR("32-bit overflow in --read-timer parameter: %s", opt_arg);
ret = CMD_ERROR;
if (v != (uint32_t) v) {
ERR("32-bit overflow in --read-timer parameter: %s", opt_arg);
ret = CMD_ERROR;