Create all trace directories and files with client user credentials
[lttng-tools.git] / liblttng-ustconsumer / lttng-ustconsumer.c
index 89dbefa361380ad2c317bf161a6d65cc7baae0e5..efb6be42490812d45f911b7f650254264efdc57f 100644 (file)
@@ -215,7 +215,9 @@ int lttng_ustconsumer_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;
@@ -403,6 +405,11 @@ int lttng_ustconsumer_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");
+               }
        }
 
        /* we return 0 to let the library handle the FD internally */
This page took 0.022846 seconds and 4 git commands to generate.