X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/637f91774c35d90e0e35b4f6c34b481282ea3564..cd744742c3efb60d9791f485ce57956223e4aaa0:/monitor_fdpass.c diff --git a/monitor_fdpass.c b/monitor_fdpass.c index 5401ea46..22b7882b 100644 --- a/monitor_fdpass.c +++ b/monitor_fdpass.c @@ -24,7 +24,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: monitor_fdpass.c,v 1.2 2002/03/24 17:53:16 stevesk Exp $"); +RCSID("$OpenBSD: monitor_fdpass.c,v 1.4 2002/06/26 14:50:04 deraadt Exp $"); #include @@ -38,7 +38,7 @@ mm_send_fd(int socket, int fd) struct msghdr msg; struct iovec vec; char ch = '\0'; - int n; + ssize_t n; #ifndef HAVE_ACCRIGHTS_IN_MSGHDR char tmp[CMSG_SPACE(sizeof(int))]; struct cmsghdr *cmsg; @@ -64,14 +64,14 @@ mm_send_fd(int socket, int fd) msg.msg_iovlen = 1; if ((n = sendmsg(socket, &msg, 0)) == -1) - fatal("%s: sendmsg(%d): %s", __FUNCTION__, fd, + fatal("%s: sendmsg(%d): %s", __func__, fd, strerror(errno)); if (n != 1) - fatal("%s: sendmsg: expected sent 1 got %d", - __FUNCTION__, n); + fatal("%s: sendmsg: expected sent 1 got %ld", + __func__, (long)n); #else fatal("%s: UsePrivilegeSeparation=yes not supported", - __FUNCTION__); + __func__); #endif } @@ -81,8 +81,9 @@ mm_receive_fd(int socket) #if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) struct msghdr msg; struct iovec vec; + ssize_t n; char ch; - int fd, n; + int fd; #ifndef HAVE_ACCRIGHTS_IN_MSGHDR char tmp[CMSG_SPACE(sizeof(int))]; struct cmsghdr *cmsg; @@ -102,24 +103,26 @@ mm_receive_fd(int socket) #endif if ((n = recvmsg(socket, &msg, 0)) == -1) - fatal("%s: recvmsg: %s", __FUNCTION__, strerror(errno)); + fatal("%s: recvmsg: %s", __func__, strerror(errno)); if (n != 1) - fatal("%s: recvmsg: expected received 1 got %d", - __FUNCTION__, n); + fatal("%s: recvmsg: expected received 1 got %ld", + __func__, (long)n); #ifdef HAVE_ACCRIGHTS_IN_MSGHDR if (msg.msg_accrightslen != sizeof(fd)) - fatal("%s: no fd", __FUNCTION__); + fatal("%s: no fd", __func__); #else cmsg = CMSG_FIRSTHDR(&msg); +#ifndef BROKEN_CMSG_TYPE if (cmsg->cmsg_type != SCM_RIGHTS) - fatal("%s: expected type %d got %d", __FUNCTION__, + fatal("%s: expected type %d got %d", __func__, SCM_RIGHTS, cmsg->cmsg_type); +#endif fd = (*(int *)CMSG_DATA(cmsg)); #endif return fd; #else fatal("%s: UsePrivilegeSeparation=yes not supported", - __FUNCTION__); + __func__); #endif }