This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #132560] perl-5.24.3, wrong Configure test for IPC_STAT
authorH.Merijn Brand - Tux <h.m.brand@xs4all.nl>
Sat, 14 Apr 2018 15:26:48 +0000 (17:26 +0200)
committerH.Merijn Brand - Tux <h.m.brand@xs4all.nl>
Sat, 14 Apr 2018 15:26:48 +0000 (17:26 +0200)
U/modified/d_union_semun.U

index 55f224f..6ddad1a 100644 (file)
@@ -184,21 +184,31 @@ END
 extern int errno;
 #endif
 int main() {
-    struct semid_ds arg;
+    union semun
+#ifndef HAS_UNION_SEMUN
+    {
+       int val;
+       struct semid_ds *buf;
+       unsigned short *array;
+    }
+#endif
+    arg;
+    struct semid_ds argbuf;
     int sem, st;
 
 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
     if (sem > -1) {
+       arg.buf = &argbuf;
 #      ifdef IPC_STAT
-       st = semctl(sem, 0, IPC_STAT, &arg);
+       st = semctl(sem, 0, IPC_STAT, arg);
        if (st == 0)
            printf("semid_ds\n");
        else
 #      endif /* IPC_STAT */
            printf("semctl IPC_STAT failed: errno = %d\n", errno);
 #      ifdef IPC_RMID
-       if (semctl(sem, 0, IPC_RMID, &arg) != 0)
+       if (semctl(sem, 0, IPC_RMID, arg) != 0)
 #      endif /* IPC_RMID */
            printf("semctl IPC_RMID failed: errno = %d\n", errno);
     } else