Fix: lttng create default name check
authorDavid Goulet <dgoulet@efficios.com>
Mon, 25 Mar 2013 20:30:12 +0000 (16:30 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 25 Mar 2013 20:31:14 +0000 (16:31 -0400)
Fixes #449

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng/commands/create.c

index ee51806ff5685b7ab374a1688b2c9e760ebe76a4..b14b45cd6e1fd31435612590f34e8e07d3f97a28 100644 (file)
@@ -209,9 +209,16 @@ static int create_session(void)
                        ret = LTTNG_ERR_SESSION_FAIL;
                        goto error;
                }
-               if (strncmp(opt_session_name, DEFAULT_SESSION_NAME,
+               /*
+                * Check if the session name begins with "auto-" or is exactly "auto".
+                * Both are reserved for the default session name. See bug #449 to
+                * understand why we need to check both here.
+                */
+               if ((strncmp(opt_session_name, DEFAULT_SESSION_NAME "-",
+                                       strlen(DEFAULT_SESSION_NAME) + 1) == 0) ||
+                               (strncmp(opt_session_name, DEFAULT_SESSION_NAME,
                                        strlen(DEFAULT_SESSION_NAME)) == 0 &&
-                               strlen(opt_session_name) == strlen(DEFAULT_SESSION_NAME)) {
+                               strlen(opt_session_name) == strlen(DEFAULT_SESSION_NAME))) {
                        ERR("%s is a reserved keyword for default session(s)",
                                        DEFAULT_SESSION_NAME);
                        ret = CMD_ERROR;
This page took 0.028439 seconds and 4 git commands to generate.