Create all trace directories and files with client user credentials
[lttng-tools.git] / lttng-sessiond / ust-app.c
index 1b5d6fbf136ff4c29cf133a41ce9b945eee64868..77dcc71a6fee77bbcc28d1298eb90355566fb630 100644 (file)
@@ -770,6 +770,8 @@ static void shadow_copy_session(struct ust_app_session *ua_sess,
        DBG2("Shadow copy of session handle %d", ua_sess->handle);
 
        ua_sess->id = usess->id;
+       ua_sess->uid = usess->uid;
+       ua_sess->gid = usess->gid;
 
        ret = snprintf(ua_sess->path, PATH_MAX,
                        "%s/%s-%d-%s",
@@ -1197,6 +1199,11 @@ static int create_ust_app_metadata(struct ust_app_session *ua_sess,
                        PERROR("mkdir UST metadata");
                        goto error;
                }
+               ret = chown(ua_sess->path, ua_sess->uid, ua_sess->gid);
+               if (ret < 0) {
+                       ERR("Unable to change owner of %s", ua_sess->path);
+                       perror("chown");
+               }
                umask(old_umask);
 
                ret = snprintf(ua_sess->metadata->pathname, PATH_MAX,
This page took 0.023041 seconds and 4 git commands to generate.