@ -15,5 +15,7 @@ system).
The peer can then use io_receivefd(3) to receive the file descriptor.
Note that the passed descriptor stays open in the sending process.
.SH "RETURN VALUE"
io_passfd returns 0 on success, -1 on error (setting errno accordingly).
.SH "SEE ALSO"
io_receivefd(3)
@ -31,5 +31,5 @@ int io_passfd(int64 sock,int64 fd) {
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
*((int*)CMSG_DATA(cmsg))=fd;
msg.msg_controllen = cmsg->cmsg_len;
return sendmsg(sock,&msg,0);
return sendmsg(sock,&msg,0)>=0?0:-1;
}