Relay rotate pending command
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index a1e10f25e82176393f92206c2779d09355c063e6..3db9b89b440d12796ce7565423cac04d2f7db2ad 100644 (file)
@@ -2485,9 +2485,22 @@ int lttng_create_session_snapshot(const char *name, const char *snapshot_url)
 
        lsm.u.uri.size = size;
 
+       /*
+        * If the user does not specify a custom subdir, use the session name.
+        */
+       if (size > 0 && uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) {
+               ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s", name);
+               if (ret < 0) {
+                       PERROR("snprintf uri subdir");
+                       ret = -LTTNG_ERR_FATAL;
+                       goto error;
+               }
+       }
+
        ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, uris,
                        sizeof(struct lttng_uri) * size, NULL);
 
+error:
        free(uris);
        return ret;
 }
This page took 0.025845 seconds and 5 git commands to generate.