Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/mount_portal Use CMSG_SPACE() for buffer when receiving...



details:   https://anonhg.NetBSD.org/src/rev/c776b26cc129
branches:  trunk
changeset: 750182:c776b26cc129
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Dec 19 16:01:25 2009 +0000

description:
Use CMSG_SPACE() for buffer when receiving file descriptors.
Doesn't break i386 and might be better for sparc64.

diffstat:

 sbin/mount_portal/puffs_portal.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 9d4db0a36cac -r c776b26cc129 sbin/mount_portal/puffs_portal.c
--- a/sbin/mount_portal/puffs_portal.c  Sat Dec 19 15:03:34 2009 +0000
+++ b/sbin/mount_portal/puffs_portal.c  Sat Dec 19 16:01:25 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_portal.c,v 1.2 2009/12/05 20:29:19 pooka Exp $   */
+/*     $NetBSD: puffs_portal.c,v 1.3 2009/12/19 16:01:25 pooka Exp $   */
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: puffs_portal.c,v 1.2 2009/12/05 20:29:19 pooka Exp $");
+__RCSID("$NetBSD: puffs_portal.c,v 1.3 2009/12/19 16:01:25 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -118,7 +118,7 @@
        int error, rv;
 
        rv = 0;
-       cmp = emalloc(CMSG_LEN(sizeof(int)));
+       cmp = emalloc(CMSG_SPACE(sizeof(int)));
 
        iov.iov_base = &error;
        iov.iov_len = sizeof(int);
@@ -127,7 +127,7 @@
        msg.msg_name = NULL;
        msg.msg_namelen = 0;
        msg.msg_control = cmp;
-       msg.msg_controllen = CMSG_LEN(sizeof(int));
+       msg.msg_controllen = CMSG_SPACE(sizeof(int));
 
        n = recvmsg(fd, &msg, 0);
        if (n == -1) {



Home | Main Index | Thread Index | Old Index