From: David Goulet Date: Tue, 14 Jun 2011 19:51:13 +0000 (-0400) Subject: Fix mkdir error handling X-Git-Tag: v2.0-pre1~81 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6beb22421cf1641eb09813c167741e27cf5f58dc;p=lttng-tools.git Fix mkdir error handling Signed-off-by: David Goulet --- diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index 8c113fab3..987389284 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -637,9 +637,11 @@ static int create_trace_dir(struct ltt_kernel_session *session) // TODO: recursive create dir ret = mkdir(chan->pathname, S_IRWXU | S_IRWXG ); if (ret < 0) { - perror("mkdir trace path"); - ret = -errno; - goto error; + if (ret != EEXIST) { + perror("mkdir trace path"); + ret = -errno; + goto error; + } } } @@ -1514,8 +1516,11 @@ static int set_kconsumerd_sockets(void) ret = mkdir(KCONSUMERD_PATH, S_IRWXU | S_IRWXG); if (ret < 0) { - ERR("Failed to create " KCONSUMERD_PATH); - goto error; + if (errno != EEXIST) { + ERR("Failed to create " KCONSUMERD_PATH); + goto error; + } + ret = 0; } /* Create the kconsumerd error unix socket */