projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: snapshot command mishandles missing arguments
[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 0ae2b10968456adc54d4df7f4985458268c4e8f7..83f0af65d9b67cd306361d033f7f8a6ef3bfcdc9 100644
(file)
--- a/
src/bin/lttng/commands/create.c
+++ b/
src/bin/lttng/commands/create.c
@@
-24,7
+24,7
@@
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <time.h>
+#include <
common/compat/
time.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
@@
-342,6
+342,10
@@
static int create_session(void)
/* Use default live URL if NO url is/are found. */
if ((opt_live_timer && !opt_url) && (opt_live_timer && !opt_data_url)) {
/* Use default live URL if NO url is/are found. */
if ((opt_live_timer && !opt_url) && (opt_live_timer && !opt_data_url)) {
+ /* Override the url */
+ free(url);
+ url = NULL;
+
ret = asprintf(&alloc_url, "net://127.0.0.1");
if (ret < 0) {
PERROR("asprintf default live URL");
ret = asprintf(&alloc_url, "net://127.0.0.1");
if (ret < 0) {
PERROR("asprintf default live URL");
@@
-615,6
+619,7
@@
int cmd_create(int argc, const char **argv)
{
int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
char *opt_arg = NULL;
{
int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
char *opt_arg = NULL;
+ const char *leftover = NULL;
static poptContext pc;
pc = poptGetContext(NULL, argc, argv, long_options, 0);
static poptContext pc;
pc = poptGetContext(NULL, argc, argv, long_options, 0);
@@
-709,6
+714,13
@@
int cmd_create(int argc, const char **argv)
}
opt_session_name = (char*) poptGetArg(pc);
}
opt_session_name = (char*) poptGetArg(pc);
+ leftover = poptGetArg(pc);
+ if (leftover) {
+ ERR("Unknown argument: %s", leftover);
+ ret = CMD_ERROR;
+ goto end;
+ }
+
command_ret = create_session();
if (command_ret) {
success = 0;
command_ret = create_session();
if (command_ret) {
success = 0;
This page took
0.031699 seconds
and
4
git commands to generate.