Module Name:    src
Committed By:   pooka
Date:           Sat Dec 19 16:01:25 UTC 2009

Modified Files:
        src/sbin/mount_portal: puffs_portal.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/mount_portal/puffs_portal.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/mount_portal/puffs_portal.c
diff -u src/sbin/mount_portal/puffs_portal.c:1.2 src/sbin/mount_portal/puffs_portal.c:1.3
--- src/sbin/mount_portal/puffs_portal.c:1.2	Sat Dec  5 20:29:19 2009
+++ src/sbin/mount_portal/puffs_portal.c	Sat Dec 19 16:01:25 2009
@@ -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) {

Reply via email to