about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/recvmsg.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-31 11:14:46 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-31 11:14:46 +0000
commitc3966b88eeb1e0b5726ca16a70a94269d40ee152 (patch)
tree01b5267fea81493dda40ddbad0391c4a35c19c76 /sysdeps/unix/sysv/linux/recvmsg.c
parentbdd421cc6d055af6a1a561344b2fa56267cad617 (diff)
downloadglibc-c3966b88eeb1e0b5726ca16a70a94269d40ee152.tar.gz
glibc-c3966b88eeb1e0b5726ca16a70a94269d40ee152.tar.xz
glibc-c3966b88eeb1e0b5726ca16a70a94269d40ee152.zip
Update.
1998-07-31 11:10  Ulrich Drepper  <drepper@cygnus.com>

	* elf/elf.h: Add lots of new symbols from Irix and Solaris.

	* sysdeps/unix/sysv/linux/sigstack.c: Include stddef.h to get NULL
	definition.

1998-07-31  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* sunrpc/xcrypt.c: Use only the first 8 characters of the password.

1998-07-30 21:06 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* sysdeps/generic/glob.c: Undefine strdup before defining it,
	because bits/string2.h may have defined it already.

1998-07-29  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* stdio-common/vfscanf.c: Optimize looking for type modifiers.
	Fix recognition of 'a' modifier vs. 'a' format.
	(TYPEMOD): Removed.

	* stdio-common/printf-parse.h (parse_one_spec): Optimize looking
	for type modifiers.  Fix recognition of 'hh' modifier.

1998-07-31  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* sunrpc/svc_unix.c: Fix typo.

1998-07-31  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* sysdeps/unix/sysv/linux/recvmsg.c: Don't check for SCM_CREDS before
	syscall.
Diffstat (limited to 'sysdeps/unix/sysv/linux/recvmsg.c')
-rw-r--r--sysdeps/unix/sysv/linux/recvmsg.c58
1 files changed, 20 insertions, 38 deletions
diff --git a/sysdeps/unix/sysv/linux/recvmsg.c b/sysdeps/unix/sysv/linux/recvmsg.c
index 66970bcb89..52a0abcf67 100644
--- a/sysdeps/unix/sysv/linux/recvmsg.c
+++ b/sysdeps/unix/sysv/linux/recvmsg.c
@@ -39,53 +39,35 @@ __libc_recvmsg (int fd, struct msghdr *message, int flags)
 {
   struct cmsghdr *cm;
   int ret;
-  int found_creds = 0;
 
-  /* Must check for space first. */
+  ret = __syscall_recvmsg (fd, message, flags);
+
+  if (ret == -1)
+    return ret;
+
+  /* Postprocess the message control block for SCM_CREDS.  */
   cm = CMSG_FIRSTHDR (message);
   while (cm)
     {
       if (cm->cmsg_type == SCM_CREDS)
-	{
-	  if (cm->cmsg_len < CMSG_SPACE (sizeof (struct cmsgcred)))
-	    {
-	      __set_errno (EINVAL);
-	      return -1;
-	    }
-	  found_creds = 1;
+ 	{
+	  struct cmsgcred *c = (struct cmsgcred *) CMSG_DATA (cm);
+	  struct __kernel_ucred u;
+	  int i;
+	  memcpy (&u, CMSG_DATA (cm), sizeof (struct __kernel_ucred));
+
+	  c->cmcred_pid = u.pid;
+	  c->cmcred_uid = u.uid;
+	  c->cmcred_gid = u.gid;
+
+	  c->cmcred_euid = -1;
+	  c->cmcred_ngroups = 0;
+	  for (i = 0; i < CMGROUP_MAX; i++)
+	    c->cmcred_groups[i] = -1;
 	}
       cm = CMSG_NXTHDR (message, cm);
     }
 
-
-  ret = __syscall_recvmsg (fd, message, flags);
-
-  if (ret == -1)
-    return ret;
-
-  /* Postprocess the message control block for SCM_CREDS. */
-  cm = CMSG_FIRSTHDR (message);
-  if (found_creds)
-    while (cm)
-      {
-	if (cm->cmsg_type == SCM_CREDS)
-	  {
-	    struct cmsgcred *c = (struct cmsgcred *) CMSG_DATA (cm);
-	    struct __kernel_ucred u;
-	    int i;
-	    memcpy (&u, CMSG_DATA (cm), sizeof (struct __kernel_ucred));
-
-	    c->cmcred_pid = u.pid;
-	    c->cmcred_uid = u.uid;
-	    c->cmcred_gid = u.gid;
-
-	    c->cmcred_euid = -1;
-	    c->cmcred_ngroups = 0;
-	    for (i = 0; i < CMGROUP_MAX; i++)
-	      c->cmcred_groups[i] = -1;
-	  }
-	cm = CMSG_NXTHDR (message, cm);
-      }
   return ret;
 }