summaryrefslogtreecommitdiff
path: root/monitor_fdpass.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-03-27 10:53:23 +1100
committerDamien Miller <djm@mindrot.org>2008-03-27 10:53:23 +1100
commitf92e063872ffc12fd82be7e344e8aeeeefd7a8ee (patch)
tree67daf35ab721cfe26d901f4027b0941ae720a4d6 /monitor_fdpass.c
parent5447eb2454961bdc1d01e6630a02bf844a799713 (diff)
downloadopenssh-git-f92e063872ffc12fd82be7e344e8aeeeefd7a8ee.tar.gz
- deraadt@cvs.openbsd.org 2008/03/13 01:49:53
[monitor_fdpass.c] Correct CMSG_SPACE and CMSG_LEN usage everywhere in the tree. Due to an extensive discussion with otto, kettenis, millert, and hshoexer
Diffstat (limited to 'monitor_fdpass.c')
-rw-r--r--monitor_fdpass.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index fb00ab7a..a3e995df 100644
--- a/monitor_fdpass.c
+++ b/monitor_fdpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_fdpass.c,v 1.14 2008/03/02 18:19:35 deraadt Exp $ */
+/* $OpenBSD: monitor_fdpass.c,v 1.15 2008/03/13 01:49:53 deraadt Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -52,7 +52,8 @@ mm_send_fd(int sock, int fd)
union {
struct cmsghdr hdr;
char tmp[CMSG_SPACE(sizeof(int))];
- } tmp;
+ char buf[CMSG_SPACE(sizeof(int))];
+ } cmsgbuf;
struct cmsghdr *cmsg;
#endif
@@ -61,8 +62,8 @@ mm_send_fd(int sock, int fd)
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
#else
- msg.msg_control = (caddr_t)&tmp;
- msg.msg_controllen = CMSG_LEN(sizeof(int));
+ msg.msg_control = (caddr_t)&cmsgbuf.buf;
+ msg.msg_controllen = sizeof(cmsgbuf.buf);
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
cmsg->cmsg_level = SOL_SOCKET;
@@ -104,9 +105,9 @@ mm_receive_fd(int sock)
int fd;
#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
union {
- char tmp[CMSG_SPACE(sizeof(int))];
struct cmsghdr hdr;
- } tmp;
+ char buf[CMSG_SPACE(sizeof(int))];
+ } cmsgbuf;
struct cmsghdr *cmsg;
#endif
@@ -119,8 +120,8 @@ mm_receive_fd(int sock)
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
#else
- msg.msg_control = &tmp;
- msg.msg_controllen = sizeof(tmp);
+ msg.msg_control = &cmsgbuf.buf;
+ msg.msg_controllen = sizeof(cmsgbuf.buf);
#endif
if ((n = recvmsg(sock, &msg, 0)) == -1) {