X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fsnapshot.c;h=465d864de1d15c977b53f3497bd6945ce28524c2;hb=9a890ce83979d66624ba28c6c3dc3d2f00b066a4;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..465d864de 100644 --- a/src/bin/lttng/commands/snapshot.c +++ b/src/bin/lttng/commands/snapshot.c @@ -15,7 +15,7 @@ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -294,7 +294,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 +376,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 +567,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 +668,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 +757,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)");