Fix: streamline ret/errno of run_as()
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index fbc3bbb43d5e3d9164606676dc38875d05473823..819817d149922d5b2a6b02eb42230a3e35f21fe6 100644 (file)
@@ -352,8 +352,12 @@ static int create_ust_streams(struct lttng_consumer_channel *channel,
                /* Keep stream reference when creating metadata. */
                if (channel->type == CONSUMER_CHANNEL_TYPE_METADATA) {
                        channel->metadata_stream = stream;
-                       stream->ust_metadata_poll_pipe[0] = ust_metadata_pipe[0];
-                       stream->ust_metadata_poll_pipe[1] = ust_metadata_pipe[1];
+                       if (channel->monitor) {
+                               /* Set metadata poll pipe if we created one */
+                               memcpy(stream->ust_metadata_poll_pipe,
+                                               ust_metadata_pipe,
+                                               sizeof(ust_metadata_pipe));
+                       }
                }
        }
 
@@ -500,7 +504,6 @@ error_open:
                        closeret = run_as_unlink(shm_path,
                                        channel->uid, channel->gid);
                        if (closeret) {
-                               errno = -closeret;
                                PERROR("unlink %s", shm_path);
                        }
                }
@@ -1831,7 +1834,6 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
                        }
                        ret = run_as_unlink(shm_path, chan->uid, chan->gid);
                        if (ret) {
-                               errno = -ret;
                                PERROR("unlink %s", shm_path);
                        }
                }
This page took 0.023944 seconds and 4 git commands to generate.