Fix: don't start the relayd with a wrong --output dir
authorDavid Goulet <dgoulet@efficios.com>
Mon, 6 May 2013 18:41:17 +0000 (14:41 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 6 May 2013 18:47:05 +0000 (14:47 -0400)
The -o, --output option never supported a relative path but still the
relayd was able to start.

This makes sure the relayd does not start without an absolute pathname.
The help and man are also updated to document this behavior.

Ticket #523 has been opened as a feature request to support relative
path.

Fixes #481

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
doc/man/lttng-relayd.8
src/bin/lttng-relayd/main.c

index cd1aa7845df6f005b300a8f6625771494212cce1..44631b1b2bbb4a171d14f9d620f893dd08c1db61 100644 (file)
@@ -51,13 +51,13 @@ There is three debugging level which will print on stderr. Maximum verbosity is
 Start as a daemon
 .TP
 .BR "-C, --control-port"
-Control port URI (tcp://0.0.0.0:5342 is the default)
+Control port URL (tcp://0.0.0.0:5342 is the default)
 .TP
 .BR "-D, --data-port"
-Data port URI (tcp://0.0.0.0:5343 is the default)
+Data port URL (tcp://0.0.0.0:5343 is the default)
 .TP
 .BR "-o, --output"
-Output base directory (~/lttng-traces is the default)
+Output base directory. Must use an absolute path (~/lttng-traces is the default)
 .TP
 .BR "-V, --version"
 Show version number
index 71c9f2b49105ac665faf805c444d7ef6a984b548..3b9f6708a3685e61e0a6918e94732046a9b9151f 100644 (file)
@@ -105,12 +105,12 @@ static
 void usage(void)
 {
        fprintf(stderr, "Usage: %s OPTIONS\n\nOptions:\n", progname);
-       fprintf(stderr, "  -h, --help                         Display this usage.\n");
-       fprintf(stderr, "  -d, --daemonize                    Start as a daemon.\n");
-       fprintf(stderr, "  -C, --control-port                 Control port listening (URI)\n");
-       fprintf(stderr, "  -D, --data-port                    Data port listening (URI)\n");
-       fprintf(stderr, "  -o, --output                       Output path for traces (PATH)\n");
-       fprintf(stderr, "  -v, --verbose                      Verbose mode. Activate DBG() macro.\n");
+       fprintf(stderr, "  -h, --help                Display this usage.\n");
+       fprintf(stderr, "  -d, --daemonize           Start as a daemon.\n");
+       fprintf(stderr, "  -C, --control-port URL    Control port listening.\n");
+       fprintf(stderr, "  -D, --data-port URL       Data port listening.\n");
+       fprintf(stderr, "  -o, --output PATH         Output path for traces. Must use an absolute path.\n");
+       fprintf(stderr, "  -v, --verbose             Verbose mode. Activate DBG() macro.\n");
 }
 
 static
@@ -2071,6 +2071,11 @@ int main(int argc, char **argv)
 
        /* Try to create directory if -o, --output is specified. */
        if (opt_output_path) {
+               if (*opt_output_path != '/') {
+                       ERR("Please specify an absolute path for -o, --output PATH");
+                       goto exit;
+               }
+
                ret = utils_mkdir_recursive(opt_output_path, S_IRWXU | S_IRWXG);
                if (ret < 0) {
                        ERR("Unable to create %s", opt_output_path);
This page took 0.027671 seconds and 4 git commands to generate.