You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Dirk Groeneveld <dg...@uci.edu> on 2006/02/11 02:24:30 UTC
bug in apr_shm_create?
Hi!
I think I found a bug in shmem/unix/shm.c around line 317.
In line 302, the file is created with the flags APR_CREATE | APR_EXCL
(among others), and in line 316 shmget is called with IPC_CREAT |
IPC_EXCL, which fails because the first call already created the file. It
seems to work without IPC_CREAT, but I am no expert on shmget and am not
sure if this is the way to fix it.
The attached patch takes out both the IPC_CREAT and IPC_EXCL flags. I
wasn't sure whether to keep IPC_CREAT. It might make a difference if
someone else is messing with the file at the same time, so I decided to
prefer failing due to a missing file over continuing with potentially
undefined results.
Dirk
Re: bug in apr_shm_create?
Posted by Dirk Groeneveld <dg...@uci.edu>.
Nevermind that, I figured it out.
Files are not the same as shm areas, at least not on linux, at least not
with shmget. The file being there doesn't mean that there is an shm and
vice versa. The way of naming them just happens to be similar.
Sorry about that,
Dirk
On Fri, 10 Feb 2006, Dirk Groeneveld wrote:
> Hi!
>
> I think I found a bug in shmem/unix/shm.c around line 317.
>
> In line 302, the file is created with the flags APR_CREATE | APR_EXCL (among
> others), and in line 316 shmget is called with IPC_CREAT | IPC_EXCL, which
> fails because the first call already created the file. It seems to work
> without IPC_CREAT, but I am no expert on shmget and am not sure if this is
> the way to fix it.
>
> The attached patch takes out both the IPC_CREAT and IPC_EXCL flags. I wasn't
> sure whether to keep IPC_CREAT. It might make a difference if someone else is
> messing with the file at the same time, so I decided to prefer failing due to
> a missing file over continuing with potentially undefined results.
>
> Dirk
>