Create all trace directories and files with client user credentials
[lttng-tools.git] / liblttng-kconsumer / lttng-kconsumer.c
index e9861f20fb6b2e11103dacfc8bf36c7e0b77c527..242047ef0237a9af9f6914a6a2cbc969bde2f1ed 100644 (file)
@@ -256,7 +256,9 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                                msg.u.stream.state,
                                msg.u.stream.mmap_len,
                                msg.u.stream.output,
-                               msg.u.stream.path_name);
+                               msg.u.stream.path_name,
+                               msg.u.stream.uid,
+                               msg.u.stream.gid);
                if (new_stream == NULL) {
                        lttng_consumer_send_error(ctx, CONSUMERD_OUTFD_ERROR);
                        goto end;
@@ -401,6 +403,11 @@ int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
                        goto error;
                }
                stream->out_fd = ret;
+               ret = chown(stream->path_name, stream->uid, stream->gid);
+               if (ret < 0) {
+                       ERR("Changing ownership of %s", stream->path_name);
+                       perror("chown");
+               }
        }
 
        if (stream->output == LTTNG_EVENT_MMAP) {
This page took 0.023239 seconds and 4 git commands to generate.