about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-07-16 00:32:45 +0000
committerUlrich Drepper <drepper@redhat.com>2002-07-16 00:32:45 +0000
commit9111e7bf05b997efd54d9aa88d2f757aaa8d7dd2 (patch)
treeff97c1d4e99d5abf17c4b212b91ca303eaf5bb96 /sysdeps
parentdae8cccd77cd150d240f341cac4e3cefac4ef1ec (diff)
downloadglibc-9111e7bf05b997efd54d9aa88d2f757aaa8d7dd2.tar.gz
glibc-9111e7bf05b997efd54d9aa88d2f757aaa8d7dd2.tar.xz
glibc-9111e7bf05b997efd54d9aa88d2f757aaa8d7dd2.zip
(__old_semctl, __new_semctl): Only use va_arg if the argument will be used.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/semctl.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index f2d71ed684..a3d9e588a0 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -69,8 +69,23 @@ __old_semctl (int semid, int semnum, int cmd, ...)
 
   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 cmd, ...)
 
   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);