X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=ust-consumerd%2Fust-consumerd.c;h=0761253183eef1b5509a201a63e46611456f1b68;hb=cfa0520d911287f5c470d74272c578bc041077bf;hp=ce2ee40a339a96b05e880c7355af1a2e63a2f2f6;hpb=fbae86d664c12e450d3cb702b602701d37781b41;p=lttng-ust.git diff --git a/ust-consumerd/ust-consumerd.c b/ust-consumerd/ust-consumerd.c index ce2ee40a..07612531 100644 --- a/ust-consumerd/ust-consumerd.c +++ b/ust-consumerd/ust-consumerd.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -192,8 +193,8 @@ int on_open_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf) trace_path = USTCONSUMER_DEFAULT_TRACE_PATH; } - if (asprintf(&tmp, "%s/%u_%lld", trace_path, buf->pid, buf->pidunique) < 0) { - ERR("on_open_buffer : asprintf failed (%s/%u_%lld)", + if (asprintf(&tmp, "%s/%u_%" PRId64 "", trace_path, buf->pid, buf->pidunique) < 0) { + ERR("on_open_buffer : asprintf failed (%s/%u_%" PRId64 ")", trace_path, buf->pid, buf->pidunique); return 1; } @@ -205,12 +206,16 @@ int on_open_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf) } free(tmp); - if (asprintf(&tmp, "%s/%u_%lld/%s", trace_path, buf->pid, buf->pidunique, buf->name) < 0) { - ERR("on_open_buffer : asprintf failed (%s/%u_%lld/%s)", + if (asprintf(&tmp, "%s/%u_%" PRId64 "/%s", trace_path, buf->pid, buf->pidunique, buf->name) < 0) { + ERR("on_open_buffer : asprintf failed (%s/%u_%" PRId64 "/%s)", trace_path, buf->pid, buf->pidunique, buf->name); return 1; } +again: result = fd = open(tmp, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 00600); + if (result == -1 && errno == EINTR) + goto again; + if(result == -1) { PERROR("open"); ERR("failed opening trace file %s", tmp); @@ -225,7 +230,12 @@ int on_open_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf) int on_close_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf) { struct buffer_info_local *buf_local = buf->user_data; - int result = close(buf_local->file_fd); + int result; + +again: + result = close(buf_local->file_fd); + if (result == -1 && errno == EINTR) + goto again; free(buf_local); if(result == -1) { PERROR("close");