return new_fd;
}
+LTTNG_HIDDEN
+int lttcomm_create_anon_unix_socketpair(int *fds)
+{
+ if (socketpair(PF_UNIX, SOCK_STREAM, 0, fds) < 0) {
+ PERROR("socketpair");
+ return -1;
+ }
+ return 0;
+}
+
/*
* Creates a AF_UNIX local socket using pathname bind the socket upon creation
* and return the fd.
do {
len_last = iov[0].iov_len;
- ret = recvmsg(sock, &msg, 0);
+ ret = recvmsg(sock, &msg, MSG_NOSIGNAL);
if (ret > 0) {
iov[0].iov_base += ret;
iov[0].iov_len -= ret;
msg.msg_controllen = CMSG_LEN(sizeof_fds);
cmptr = CMSG_FIRSTHDR(&msg);
+ if (!cmptr) {
+ return -1;
+ }
cmptr->cmsg_level = SOL_SOCKET;
cmptr->cmsg_type = SCM_RIGHTS;
cmptr->cmsg_len = CMSG_LEN(sizeof_fds);
msg.msg_controllen = CMSG_LEN(sizeof_cred);
cmptr = CMSG_FIRSTHDR(&msg);
+ if (!cmptr) {
+ return -1;
+ }
cmptr->cmsg_level = SOL_SOCKET;
cmptr->cmsg_type = LTTNG_SOCK_CREDS;
cmptr->cmsg_len = CMSG_LEN(sizeof_cred);