X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=3db9b89b440d12796ce7565423cac04d2f7db2ad;hb=10d653513d572b8727d6935767a96c9dd82e4fe2;hp=a1e10f25e82176393f92206c2779d09355c063e6;hpb=25e9873d19b2846dc373fc7e854ef33e55033d35;p=lttng-tools.git 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; }