X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=3db9b89b440d12796ce7565423cac04d2f7db2ad;hp=a1e10f25e82176393f92206c2779d09355c063e6;hb=d88744a44aa5f2ca90ab87946692b9eed3120641;hpb=491d15395b58df09f8a3e7ba7404eb1f46392b79 diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index a1e10f25e..3db9b89b4 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -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; }