From: Marcus Holland-Moritz Date: Tue, 24 Mar 2009 18:37:13 +0000 (+0100) Subject: Fix perl #63924: shmget limited to 32 bit segment size on 64 bit OS X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c331296618a8003690577e0901fd07183a76094e;p=p5sagit%2Fp5-mst-13.2.git Fix perl #63924: shmget limited to 32 bit segment size on 64 bit OS Make sure the size argument to shmget() is not limited by the width of an int. Instead of storing the argument in an int, just store a pointer to the SV and use different conversions for semget() and shmget(). --- diff --git a/doio.c b/doio.c index 6135efa..2e5947f 100644 --- a/doio.c +++ b/doio.c @@ -1981,7 +1981,7 @@ Perl_do_ipcget(pTHX_ I32 optype, SV **mark, SV **sp) { dVAR; const key_t key = (key_t)SvNVx(*++mark); - const I32 n = (optype == OP_MSGGET) ? 0 : SvIVx(*++mark); + SV *nsv = optype == OP_MSGGET ? NULL : *++mark; const I32 flags = SvIVx(*++mark); PERL_ARGS_ASSERT_DO_IPCGET; @@ -1996,11 +1996,11 @@ Perl_do_ipcget(pTHX_ I32 optype, SV **mark, SV **sp) #endif #ifdef HAS_SEM case OP_SEMGET: - return semget(key, n, flags); + return semget(key, (int) SvIV(nsv), flags); #endif #ifdef HAS_SHM case OP_SHMGET: - return shmget(key, n, flags); + return shmget(key, (size_t) SvUV(nsv), flags); #endif #if !defined(HAS_MSG) || !defined(HAS_SEM) || !defined(HAS_SHM) default: