X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=liblttng-ust-comm%2Flttng-ust-comm.c;h=1e2fd1a04395a2f364342d0b5c4d4bf49272489f;hb=2d362ec52d6a6c4e09d43c79b3d2e801b2ec6870;hp=9baa4dc50d3a3a48fb429c1ce4e7026e5a1f5ae5;hpb=49365f4b706194cafe75d8b759554bf9de743c1d;p=lttng-ust.git diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c index 9baa4dc5..1e2fd1a0 100644 --- a/liblttng-ust-comm/lttng-ust-comm.c +++ b/liblttng-ust-comm/lttng-ust-comm.c @@ -172,13 +172,9 @@ int ustcomm_accept_unix_sock(int sock) new_fd = accept(sock, (struct sockaddr *) &sun, &len); if (new_fd < 0) { perror("accept"); - goto error; + return -1; } - return new_fd; - -error: - return -1; } /* @@ -258,7 +254,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"); } @@ -291,8 +287,10 @@ ssize_t ustcomm_send_unix_sock(int sock, void *buf, size_t len) * by ignoring SIGPIPE, but we don't have this luxury on the * libust side. */ - ret = sendmsg(sock, &msg, MSG_NOSIGNAL); - if (ret < 0) { + do { + ret = sendmsg(sock, &msg, MSG_NOSIGNAL); + } while (ret < 0 && errno == EINTR); + if (ret < 0 && errno != EPIPE) { perror("sendmsg"); } @@ -308,10 +306,9 @@ int ustcomm_close_unix_sock(int sock) { int ret; - /* Shutdown receptions and transmissions */ - ret = shutdown(sock, SHUT_RDWR); + ret = close(sock); if (ret < 0) { - perror("shutdown"); + perror("close"); } return ret; @@ -355,8 +352,10 @@ ssize_t ustcomm_send_fds_unix_sock(int sock, void *buf, int *fds, size_t nb_fd, msg.msg_iov = iov; msg.msg_iovlen = 1; - ret = sendmsg(sock, &msg, 0); - if (ret < 0) { + do { + ret = sendmsg(sock, &msg, MSG_NOSIGNAL); + } while (ret < 0 && errno == EINTR); + if (ret < 0 && errno != EPIPE) { perror("sendmsg"); } @@ -475,7 +474,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)) {