Skip Menu |
 

This queue is for tickets about the IPC-SysV CPAN distribution.

Report information
The Basics
Id: 112110
Status: resolved
Priority: 0/
Queue: IPC-SysV

People
Owner: Nobody in particular
Requestors: JHI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.05
Fixed in: (no value)



Subject: invalid shmid should set errno
Download (untitled) / with headers
text/plain 303b
Awfully sorry about this... but I realized my shmat() patch was a bit lacking. Namely, it didn't set the errno in the case of invalid shmid. Patch against 2.05 attached. Tested in OS X, FreeBSD, Linux, and Solaris. The SETERRNO() defining might be paranoia, but cannot remember when it was added.
Subject: 0001-Need-to-set-the-errno-in-case-of-bogus-shmid.patch
From aa1ba210ebbcb926c69ff6898007ae19e78c8bdd Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi <jhi@iki.fi> Date: Wed, 17 Feb 2016 21:09:26 -0500 Subject: [PATCH] Need to set the errno in case of bogus shmid. --- cpan/IPC-SysV/SysV.xs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpan/IPC-SysV/SysV.xs b/cpan/IPC-SysV/SysV.xs index 121a164..88e4042 100644 --- a/cpan/IPC-SysV/SysV.xs +++ b/cpan/IPC-SysV/SysV.xs @@ -114,6 +114,10 @@ static void assert_data_length(const char *name, int got, int expected) } } +#ifndef SETERRNO +# define SETERRNO(errcode,vmserrcode) (errno = (errcode)) +#endif + #include "const-c.inc" @@ -398,6 +402,7 @@ shmat(id, addr, flag) ST(0) = shm == (void *) -1 ? &PL_sv_undef : sv_2mortal(newSVpvn((char *) &shm, sizeof(void *))); } else { + SETERRNO(EINVAL,LIB_INVARG); ST(0) = &PL_sv_undef; } XSRETURN(1); -- 2.7.1
Subject: updated [PATCH] invalid shmid should set errno
Download (untitled) / with headers
text/plain 510b
On Wed Feb 17 22:31:43 2016, JHI wrote: Show quoted text
> Awfully sorry about this... but I realized my shmat() patch was a bit > lacking. > > Namely, it didn't set the errno in the case of invalid shmid. > > Patch against 2.05 attached. Tested in OS X, FreeBSD, Linux, and > Solaris. The SETERRNO() defining might be paranoia, but cannot > remember when it was added.
Updated patch: the SETERRNO definition is from 2002 or so, so I think we can sort of assume it. So the change is one added line, the SETERRNO call.
Subject: 0001-Need-to-set-the-errno-in-case-of-bogus-shmid.patch
From d6d1cf65697b6b3524c6bf8667958f0c84739632 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi <jhi@iki.fi> Date: Wed, 17 Feb 2016 21:09:26 -0500 Subject: [PATCH] Need to set the errno in case of bogus shmid. --- cpan/IPC-SysV/SysV.xs | 1 + 1 file changed, 1 insertion(+) diff --git a/cpan/IPC-SysV/SysV.xs b/cpan/IPC-SysV/SysV.xs index 121a164..490d410 100644 --- a/cpan/IPC-SysV/SysV.xs +++ b/cpan/IPC-SysV/SysV.xs @@ -398,6 +398,7 @@ shmat(id, addr, flag) ST(0) = shm == (void *) -1 ? &PL_sv_undef : sv_2mortal(newSVpvn((char *) &shm, sizeof(void *))); } else { + SETERRNO(EINVAL,LIB_INVARG); ST(0) = &PL_sv_undef; } XSRETURN(1); -- 2.7.1
This is part of IPC-SysV 2.06, which is just uploading to CPAN.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.