This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fixes the case where on 64bit big-endian boxes, calls to semctl(id,semnum,SETVAL...
[perl5.git] / doio.c
diff --git a/doio.c b/doio.c
index 98e2c42..b39c587 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -2155,11 +2155,16 @@ Perl_do_ipcctl(pTHX_ I32 optype, SV **mark, SV **sp)
 #ifdef Semctl
             union semun unsemds;
 
+            if(cmd == SETVAL) {
+                unsemds.val = PTR2nat(a);
+            }
+            else {
 #ifdef EXTRA_F_IN_SEMUN_BUF
-            unsemds.buff = (struct semid_ds *)a;
+                unsemds.buff = (struct semid_ds *)a;
 #else
-            unsemds.buf = (struct semid_ds *)a;
+                unsemds.buf = (struct semid_ds *)a;
 #endif
+            }
            ret = Semctl(id, n, cmd, unsemds);
 #else
            /* diag_listed_as: sem%s not implemented */