[PATCH] PPC semctl fix
Franz Sirl
Franz.Sirl-kernel@lauterbach.com
Sun May 12 13:35:00 GMT 2002
Hi,
the same thing Jakub already did for sparc.
Franz.
PR libc/3259
* sysdeps/unix/sysv/linux/semctl.c (__old_semctl, __new_semctl): Only use
va_arg if the argument will be used.
-------------- next part --------------
Index: sysdeps/unix/sysv/linux/semctl.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/semctl.c,v
retrieving revision 1.12
diff -u -p -r1.12 semctl.c
--- sysdeps/unix/sysv/linux/semctl.c 6 Jul 2001 04:56:13 -0000 1.12
+++ sysdeps/unix/sysv/linux/semctl.c 28 Apr 2002 21:03:16 -0000
@@ -69,8 +69,23 @@ __old_semctl (int semid, int semnum, int
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 @@ __new_semctl (int semid, int semnum, int
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);
More information about the Libc-alpha
mailing list