about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/glob.c1
-rw-r--r--sysdeps/unix/sysv/linux/recvmsg.c58
-rw-r--r--sysdeps/unix/sysv/linux/sigstack.c1
3 files changed, 22 insertions, 38 deletions
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c
index 7ab48995e2..bd92d68324 100644
--- a/sysdeps/generic/glob.c
+++ b/sysdeps/generic/glob.c
@@ -245,6 +245,7 @@ extern char *alloca ();
 #endif
 
 #ifdef _LIBC
+# undef strdup
 # define strdup(str) __strdup (str)
 # define sysconf(id) __sysconf (id)
 # define closedir(dir) __closedir (dir)
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;
 }
 
diff --git a/sysdeps/unix/sysv/linux/sigstack.c b/sysdeps/unix/sysv/linux/sigstack.c
index cbae972048..eb95f20785 100644
--- a/sysdeps/unix/sysv/linux/sigstack.c
+++ b/sysdeps/unix/sysv/linux/sigstack.c
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <signal.h>
+#include <stddef.h>
 #include <sys/syscall.h>