X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fsnapshot.c;h=846e9badc168c07da31dfea7e20579b8871d4dc2;hb=44c1a903e17ad14d5ba1cd07585a7a2415eac78a;hp=ebe1d14aa2e384d04a91bf1cd218c3055e14f043;hpb=50534d6fb4b1f0557b45919c8efad209f68b5e26;p=lttng-tools.git diff --git a/src/bin/lttng/commands/snapshot.c b/src/bin/lttng/commands/snapshot.c index ebe1d14aa..846e9badc 100644 --- a/src/bin/lttng/commands/snapshot.c +++ b/src/bin/lttng/commands/snapshot.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -294,7 +295,6 @@ static int mi_del_output(uint32_t id, const char *name) ret = lttng_snapshot_del_output(current_session_name, output); if (ret < 0) { - ret = CMD_FATAL; goto error; } @@ -377,7 +377,6 @@ static int mi_add_output(const char *url) /* This call, if successful, populates the id of the output object. */ ret = lttng_snapshot_add_output(current_session_name, output); if (ret < 0) { - ret = CMD_ERROR; goto error; } @@ -569,9 +568,7 @@ static int record(const char *url) ret = lttng_snapshot_record(current_session_name, output, 0); if (ret < 0) { if (ret == -LTTNG_ERR_MAX_SIZE_INVALID) { - ERR("The minimum size of a snapshot is computed by multiplying " - "the total amount of streams with the largest subbuffer " - "in the session."); + ERR("Invalid snapshot size. Cannot fit at least one packet per stream."); } goto error; } @@ -672,10 +669,10 @@ static int handle_command(const char **argv) cmd = &actions[i]; } - ret = -CMD_UNDEFINED; + ret = CMD_UNDEFINED; end: - /* Overwrite ret if an error occured in cmd->func() */ + /* Overwrite ret if an error occurred in cmd->func() */ ret = command_ret ? command_ret : ret; return ret; } @@ -761,7 +758,7 @@ int cmd_snapshot(int argc, const char **argv) } command_ret = handle_command(poptGetArgs(pc)); - if (command_ret < 0) { + if (command_ret) { switch (-command_ret) { case LTTNG_ERR_EPERM: ERR("The session needs to be set in no output mode (--no-output)");