summaryrefslogtreecommitdiff
path: root/src/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipc')
-rw-r--r--src/ipc/semctl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ipc/semctl.c b/src/ipc/semctl.c
index 3d79f503..673a9a8c 100644
--- a/src/ipc/semctl.c
+++ b/src/ipc/semctl.c
@@ -11,11 +11,15 @@ union semun {
int semctl(int id, int num, int cmd, ...)
{
- union semun arg;
+ union semun arg = {0};
va_list ap;
- va_start(ap, cmd);
- arg = va_arg(ap, union semun);
- va_end(ap);
+ switch (cmd) {
+ case SETVAL: case GETALL: case SETALL: case IPC_STAT: case IPC_SET:
+ case IPC_INFO: case SEM_INFO: case SEM_STAT:
+ va_start(ap, cmd);
+ arg = va_arg(ap, union semun);
+ va_end(ap);
+ }
#ifdef SYS_semctl
return syscall(SYS_semctl, id, num, cmd | IPC_64, arg.buf);
#else