--- 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);