diff options
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/semctl.c | 38 |
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); |