|
@@ -58,7 +58,10 @@ int semctl(int semid, int semnum, int cmd, ...)
|
|
|
#ifdef __NR_semctl
|
|
|
int __ret = __semctl(semid, semnum, cmd | __IPC_64, arg.__pad);
|
|
|
#if (__WORDSIZE == 32) && defined(__UCLIBC_USE_TIME64__)
|
|
|
- if (arg.__pad != NULL) {
|
|
|
+ // Only when cmd is IPC_STAT and IPC_SET, semun points to struct semid_ds.
|
|
|
+ // At this point, arg.__pad should not be NULL, but a check is added just
|
|
|
+ // to be safe.
|
|
|
+ if ((cmd & (IPC_STAT | IPC_SET)) && (arg.__pad != NULL)) {
|
|
|
arg.buf->sem_otime = (__time_t)arg.buf->__sem_otime_internal_1 | (__time_t)(arg.buf->__sem_otime_internal_2) << 32;
|
|
|
arg.buf->sem_ctime = (__time_t)arg.buf->__sem_ctime_internal_1 | (__time_t)(arg.buf->__sem_ctime_internal_2) << 32;
|
|
|
}
|