Fix: do not print EPIPE perror, as it is an expected error
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 14 Mar 2012 18:43:32 +0000 (14:43 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 14 Mar 2012 18:43:32 +0000 (14:43 -0400)
It is perfectly valid for the other end to close its socket, so do not
report broken pipe errors as perror.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-comm/lttng-ust-comm.c

index 21f48ed00bf00cfa10351df04950817bb968ea25..0781f4cecb4408f0746d8e1f3586f740d09aae4a 100644 (file)
@@ -251,7 +251,7 @@ ssize_t ustcomm_recv_unix_sock(int sock, void *buf, size_t len)
        do {
                ret = recvmsg(sock, &msg, 0);
        } while (ret < 0 && errno == EINTR);
-       if (ret < 0) {
+       if (ret < 0 && errno != EPIPE) {
                perror("recvmsg");
        }
 
@@ -285,7 +285,7 @@ ssize_t ustcomm_send_unix_sock(int sock, void *buf, size_t len)
         * libust side.
         */
        ret = sendmsg(sock, &msg, MSG_NOSIGNAL);
-       if (ret < 0) {
+       if (ret < 0 && errno != EPIPE) {
                perror("sendmsg");
        }
 
@@ -349,7 +349,7 @@ ssize_t ustcomm_send_fds_unix_sock(int sock, void *buf, int *fds, size_t nb_fd,
        msg.msg_iovlen = 1;
 
        ret = sendmsg(sock, &msg, 0);
-       if (ret < 0) {
+       if (ret < 0 && errno != EPIPE) {
                perror("sendmsg");
        }
 
@@ -468,7 +468,9 @@ int ustcomm_recv_fd(int sock)
                ret = recvmsg(sock, &msg, 0);
        } while (ret < 0 && errno == EINTR);
        if (ret < 0) {
-               perror("recvmsg");
+               if (errno != EPIPE) {
+                       perror("recvmsg");
+               }
                goto end;
        }
        if (ret != sizeof(data_fd)) {
This page took 0.025376 seconds and 4 git commands to generate.