CVS: src/si/patches glibc-2.2.5.semctl.patch,NONE,1.1

Marvin Heffler <[email protected]> Fri, 30 May 2003 08:31:14 -0700
Newsgroups gmane.linux.lsb.implementation
Message-ID <[email protected]>
Update of /cvsroot/lsb/src/si/patches
In directory sc8-pr-cvs1:/tmp/cvs-serv29612

Added Files:
	glibc-2.2.5.semctl.patch 
Log Message:
Add semctl patch to fix some ppc bugs

--- NEW FILE ---
This patch will fix some exec and fork tests for ppc32 and ppc64. It is
really just a diff between glibc 2.2.5 and glibc 2.3.2. The fix can be
applied to all architectures.

--- glibc-2.2.5.old/sysdeps/unix/sysv/linux/semctl.c    Tue Jul 10 10:57:08 2001
+++ glibc-2.2.5/sysdeps/unix/sysv/linux/semctl.c        Wed May 15 13:50:33 2002
@@ -69,8 +69,23 @@
 
   va_start (ap, cmd);
 
-  /* Get the argument.  */
-  arg = va_arg (ap, union semun);
+  /* Get the argument only if required.  */
+  arg.buf = NULL;
+  switch (cmd)
+    {
+    case SETVAL:	/* arg.val */
+    case GETALL:	/* arg.array */
+    case SETALL:
+    case IPC_STAT:	/* arg.buf */
+    case IPC_SET:
+    case SEM_STAT:
+    case IPC_INFO:	/* arg.__buf */
+    case SEM_INFO:
+      va_start (ap, cmd);
+      arg = va_arg (ap, union semun);
+      va_end (ap);
+      break;
+    }
 
   va_end (ap);
 
@@ -88,8 +103,23 @@
 
   va_start (ap, cmd);
 
-  /* Get the argument.  */
-  arg = va_arg (ap, union semun);
+  /* Get the argument only if required.  */
+  arg.buf = NULL;
+  switch (cmd)
+    {
+    case SETVAL:	/* arg.val */
+    case GETALL:	/* arg.array */
+    case SETALL:
+    case IPC_STAT:	/* arg.buf */
+    case IPC_SET:
+    case SEM_STAT:
+    case IPC_INFO:	/* arg.__buf */
+    case SEM_INFO:
+      va_start (ap, cmd);
+      arg = va_arg (ap, union semun);
+      va_end (ap);
+      break;
+    }
 
   va_end (ap);