From: Mathieu Desnoyers Date: Fri, 2 Mar 2012 20:53:09 +0000 (-0500) Subject: Fix: sendmsg EPIPE should be quiet by default (expected) X-Git-Tag: v2.0.0-rc2~5 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d2641a837d460c275884523d67120379711dc38c;p=lttng-tools.git Fix: sendmsg EPIPE should be quiet by default (expected) Acked-by: David Goulet Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/sessiond-comm/sessiond-comm.c b/src/common/sessiond-comm/sessiond-comm.c index 8a5ff1d3f..477bd1c64 100644 --- a/src/common/sessiond-comm/sessiond-comm.c +++ b/src/common/sessiond-comm/sessiond-comm.c @@ -292,7 +292,13 @@ ssize_t lttcomm_send_unix_sock(int sock, void *buf, size_t len) ret = sendmsg(sock, &msg, 0); if (ret < 0) { - PERROR("sendmsg"); + /* + * Only warn about EPIPE when quiet mode is deactivated. + * We consider EPIPE as expected. + */ + if (errno != EPIPE || !opt_quiet) { + PERROR("sendmsg"); + } } return ret; @@ -357,7 +363,13 @@ ssize_t lttcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd) ret = sendmsg(sock, &msg, 0); if (ret < 0) { - PERROR("sendmsg"); + /* + * Only warn about EPIPE when quiet mode is deactivated. + * We consider EPIPE as expected. + */ + if (errno != EPIPE || !opt_quiet) { + PERROR("sendmsg"); + } } return ret; } @@ -466,9 +478,14 @@ ssize_t lttcomm_send_creds_unix_sock(int sock, void *buf, size_t len) ret = sendmsg(sock, &msg, 0); if (ret < 0) { - PERROR("sendmsg"); + /* + * Only warn about EPIPE when quiet mode is deactivated. + * We consider EPIPE as expected. + */ + if (errno != EPIPE || !opt_quiet) { + PERROR("sendmsg"); + } } - return ret; } diff --git a/tests/lttng/kernel_all_events_basic.c b/tests/lttng/kernel_all_events_basic.c index f556db4fc..3b9fd60e7 100644 --- a/tests/lttng/kernel_all_events_basic.c +++ b/tests/lttng/kernel_all_events_basic.c @@ -29,6 +29,8 @@ #include "../utils.h" +int opt_quiet = 0; + int main(int argc, char **argv) { struct lttng_handle *handle = NULL; diff --git a/tests/lttng/kernel_event_basic.c b/tests/lttng/kernel_event_basic.c index 36eb03921..1deeaad45 100644 --- a/tests/lttng/kernel_event_basic.c +++ b/tests/lttng/kernel_event_basic.c @@ -29,6 +29,8 @@ #include "../utils.h" +int opt_quiet = 0; + int main(int argc, char **argv) { struct lttng_handle *handle = NULL; diff --git a/tests/lttng/ust_global_all_events_basic.c b/tests/lttng/ust_global_all_events_basic.c index 9feaa3057..a2750c557 100644 --- a/tests/lttng/ust_global_all_events_basic.c +++ b/tests/lttng/ust_global_all_events_basic.c @@ -29,6 +29,8 @@ #include "../utils.h" +int opt_quiet = 0; + int main(int argc, char **argv) { struct lttng_handle *handle = NULL; diff --git a/tests/lttng/ust_global_event_basic.c b/tests/lttng/ust_global_event_basic.c index 867e4391b..05c1a443e 100644 --- a/tests/lttng/ust_global_event_basic.c +++ b/tests/lttng/ust_global_event_basic.c @@ -29,6 +29,8 @@ #include "../utils.h" +int opt_quiet = 0; + int main(int argc, char **argv) { struct lttng_handle *handle = NULL;