summaryrefslogtreecommitdiff
path: root/monitor_fdpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor_fdpass.c')
-rw-r--r--monitor_fdpass.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index 0d7628fa2..641ce721e 100644
--- a/monitor_fdpass.c
+++ b/monitor_fdpass.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: monitor_fdpass.c,v 1.3 2002/06/04 23:05:49 markus Exp $"); 27RCSID("$OpenBSD: monitor_fdpass.c,v 1.4 2002/06/26 14:50:04 deraadt Exp $");
28 28
29#include <sys/uio.h> 29#include <sys/uio.h>
30 30
@@ -38,7 +38,7 @@ mm_send_fd(int socket, int fd)
38 struct msghdr msg; 38 struct msghdr msg;
39 struct iovec vec; 39 struct iovec vec;
40 char ch = '\0'; 40 char ch = '\0';
41 int n; 41 ssize_t n;
42#ifndef HAVE_ACCRIGHTS_IN_MSGHDR 42#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
43 char tmp[CMSG_SPACE(sizeof(int))]; 43 char tmp[CMSG_SPACE(sizeof(int))];
44 struct cmsghdr *cmsg; 44 struct cmsghdr *cmsg;
@@ -67,8 +67,8 @@ mm_send_fd(int socket, int fd)
67 fatal("%s: sendmsg(%d): %s", __func__, fd, 67 fatal("%s: sendmsg(%d): %s", __func__, fd,
68 strerror(errno)); 68 strerror(errno));
69 if (n != 1) 69 if (n != 1)
70 fatal("%s: sendmsg: expected sent 1 got %d", 70 fatal("%s: sendmsg: expected sent 1 got %ld",
71 __func__, n); 71 __func__, (long)n);
72#else 72#else
73 fatal("%s: UsePrivilegeSeparation=yes not supported", 73 fatal("%s: UsePrivilegeSeparation=yes not supported",
74 __func__); 74 __func__);
@@ -81,8 +81,9 @@ mm_receive_fd(int socket)
81#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) 81#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
82 struct msghdr msg; 82 struct msghdr msg;
83 struct iovec vec; 83 struct iovec vec;
84 ssize_t n;
84 char ch; 85 char ch;
85 int fd, n; 86 int fd;
86#ifndef HAVE_ACCRIGHTS_IN_MSGHDR 87#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
87 char tmp[CMSG_SPACE(sizeof(int))]; 88 char tmp[CMSG_SPACE(sizeof(int))];
88 struct cmsghdr *cmsg; 89 struct cmsghdr *cmsg;
@@ -104,8 +105,8 @@ mm_receive_fd(int socket)
104 if ((n = recvmsg(socket, &msg, 0)) == -1) 105 if ((n = recvmsg(socket, &msg, 0)) == -1)
105 fatal("%s: recvmsg: %s", __func__, strerror(errno)); 106 fatal("%s: recvmsg: %s", __func__, strerror(errno));
106 if (n != 1) 107 if (n != 1)
107 fatal("%s: recvmsg: expected received 1 got %d", 108 fatal("%s: recvmsg: expected received 1 got %ld",
108 __func__, n); 109 __func__, (long)n);
109 110
110#ifdef HAVE_ACCRIGHTS_IN_MSGHDR 111#ifdef HAVE_ACCRIGHTS_IN_MSGHDR
111 if (msg.msg_accrightslen != sizeof(fd)) 112 if (msg.msg_accrightslen != sizeof(fd))