diff --git a/io/io_passfd.3 b/io/io_passfd.3 index ce345f9..33b9dfd 100644 --- a/io/io_passfd.3 +++ b/io/io_passfd.3 @@ -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) diff --git a/io/io_passfd.c b/io/io_passfd.c index d721dce..ee21900 100644 --- a/io/io_passfd.c +++ b/io/io_passfd.c @@ -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; }