From: Rafael Garcia-Suarez Date: Sun, 10 Jan 2010 22:27:41 +0000 (+0100) Subject: [perl #71924] shmget/semget may return zero as valid id X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3365b4123660b600293d3f9bd5054523f194b5b9;p=p5sagit%2Fp5-mst-13.2.git [perl #71924] shmget/semget may return zero as valid id Documentation in perlipc thus fixed by using // instead of || --- diff --git a/pod/perlipc.pod b/pod/perlipc.pod index 962d106..25b310b 100644 --- a/pod/perlipc.pod +++ b/pod/perlipc.pod @@ -1661,7 +1661,7 @@ Here's a small example showing shared memory usage. use IPC::SysV qw(IPC_PRIVATE IPC_RMID S_IRUSR S_IWUSR); $size = 2000; - $id = shmget(IPC_PRIVATE, $size, S_IRUSR|S_IWUSR) || die "$!"; + $id = shmget(IPC_PRIVATE, $size, S_IRUSR|S_IWUSR) // die "$!"; print "shm key $id\n"; $message = "Message #1"; @@ -1683,7 +1683,7 @@ Here's an example of a semaphore: use IPC::SysV qw(IPC_CREAT); $IPC_KEY = 1234; - $id = semget($IPC_KEY, 10, 0666 | IPC_CREAT ) || die "$!"; + $id = semget($IPC_KEY, 10, 0666 | IPC_CREAT ) // die "$!"; print "shm key $id\n"; Put this code in a separate file to be run in more than one process.