summaryrefslogtreecommitdiff
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2001-10-24 10:01:11 +0000
committerbrian <brian@cvs.openbsd.org>2001-10-24 10:01:11 +0000
commit8a37b6ce40bad6ba48ed597338f4e3716243ee58 (patch)
tree132d08adf42ced9028a4a826292ceca1bc416f20 /usr.sbin/ppp
parent99281c8c0c1c848683a7c30cbd750b980ab57aa3 (diff)
Use CMSG_DATA and CMSG_SPACE macros; FreeBSD
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/ppp/bundle.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/ppp/ppp/bundle.c b/usr.sbin/ppp/ppp/bundle.c
index 595d4c7e773..5a8ccb34870 100644
--- a/usr.sbin/ppp/ppp/bundle.c
+++ b/usr.sbin/ppp/ppp/bundle.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: bundle.c,v 1.60 2001/08/21 11:06:04 brian Exp $
+ * $OpenBSD: bundle.c,v 1.61 2001/10/24 10:01:10 brian Exp $
*/
#include <sys/param.h>
@@ -1364,8 +1364,8 @@ bundle_ReceiveDatalink(struct bundle *bundle, int s)
return;
}
- fd = (int *)(cmsg + 1);
- nfd = (cmsg->cmsg_len - sizeof *cmsg) / sizeof(int);
+ fd = (int *)CMSG_DATA(cmsg);
+ nfd = ((caddr_t)cmsg + cmsg->cmsg_len - (caddr_t)fd) / sizeof(int);
if (nfd < 2) {
log_Printf(LogERROR, "Recvmsg: %d descriptor%s received (too few) !\n",
@@ -1457,7 +1457,7 @@ bundle_ReceiveDatalink(struct bundle *bundle, int s)
void
bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun)
{
- char cmsgbuf[sizeof(struct cmsghdr) + sizeof(int) * SEND_MAXFD];
+ char cmsgbuf[CMSG_SPACE(sizeof(int) * SEND_MAXFD)];
const char *constlock;
char *lock;
struct cmsghdr *cmsg;
@@ -1507,7 +1507,7 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun)
msg.msg_iovlen = 1;
msg.msg_iov = iov;
msg.msg_control = cmsgbuf;
- msg.msg_controllen = sizeof *cmsg + sizeof(int) * nfd;
+ msg.msg_controllen = CMSG_SPACE(sizeof(int) * nfd);
msg.msg_flags = 0;
cmsg = (struct cmsghdr *)cmsgbuf;
@@ -1516,7 +1516,7 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun)
cmsg->cmsg_type = SCM_RIGHTS;
for (f = 0; f < nfd; f++)
- *((int *)(cmsg + 1) + f) = fd[f];
+ *((int *)CMSG_DATA(cmsg) + f) = fd[f];
for (f = 1, expect = 0; f < niov; f++)
expect += iov[f].iov_len;