summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@LS5.informatik.uni-dortmund.de>1997-07-02 22:04:38 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-08-07 00:00:00 +1200
commit8e591e46b4c6543ed80895327199c4a628ce11b6 (patch)
treef8377358c5877ebcdc80e945c5f6bbfbbb254e87 /doio.c
parent3562ef9bd2cdbf90129e36ac9d1818321a4fe8c0 (diff)
downloadperl-8e591e46b4c6543ed80895327199c4a628ce11b6.tar.gz
semctl broken under Linux
semctl(...,[GS]ETALL,...) passes an uninitialized pointer to the syscall. Credited: Graham Barr <gbarr@ti.com> Credited: Tim Bunce <Tim.Bunce@ig.co.uk> p5p-msgid: 9707040912.AA03470@issan.informatik.uni-dortmund.de private-msgid: 33C38291.2D9302DA@ti.com
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/doio.c b/doio.c
index 62b7de9fb5..f98af9bf6f 100644
--- a/doio.c
+++ b/doio.c
@@ -1364,6 +1364,7 @@ SV **sp;
infosize = sizeof(struct semid_ds);
else if (cmd == GETALL || cmd == SETALL)
{
+ struct semid_ds semds;
#ifdef __linux__ /* XXX Need metaconfig test */
/* linux uses :
int semctl (int semid, int semnun, int cmd, union semun arg)
@@ -1374,19 +1375,14 @@ SV **sp;
ushort *array;
};
*/
- union semun semds;
- if (semctl(id, 0, IPC_STAT, semds) == -1)
+ unsemds.buf = &semds;
+ if (semctl(id, 0, IPC_STAT, unsemds) == -1)
#else
- struct semid_ds semds;
if (semctl(id, 0, IPC_STAT, &semds) == -1)
#endif
return -1;
getinfo = (cmd == GETALL);
-#ifdef __linux__ /* XXX Need metaconfig test */
- infosize = semds.buf->sem_nsems * sizeof(short);
-#else
infosize = semds.sem_nsems * sizeof(short);
-#endif
/* "short" is technically wrong but much more portable
than guessing about u_?short(_t)? */
}