This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 3/3] shm_open: sync with logic in sem_open
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 23 Jan 2014 16:54:23 +0530
- Subject: Re: [PATCH 3/3] shm_open: sync with logic in sem_open
- Authentication-results: sourceware.org; auth=none
- References: <1390458245-2287-1-git-send-email-vapier at gentoo dot org> <1390458245-2287-3-git-send-email-vapier at gentoo dot org>
No ChangeLog?
On Thu, Jan 23, 2014 at 01:24:05AM -0500, Mike Frysinger wrote:
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> sysdeps/unix/sysv/linux/shm_open.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c
> index 5f23515..940d9af 100644
> --- a/sysdeps/unix/sysv/linux/shm_open.c
> +++ b/sysdeps/unix/sysv/linux/shm_open.c
> @@ -62,7 +62,8 @@ where_is_shmfs (void)
>
> /* The canonical place is /dev/shm. This is at least what the
> documentation tells everybody to do. */
> - if (__statfs (defaultdir, &f) == 0 && f.f_type == SHMFS_SUPER_MAGIC)
> + if (__statfs (defaultdir, &f) == 0 && (f.f_type == SHMFS_SUPER_MAGIC
> + || f.f_type == RAMFS_MAGIC))
Incorrect formatting - || should align with the inner bracket.
> {
> /* It is in the normal place. */
> mountpoint.dir = (char *) defaultdir;
> @@ -86,7 +87,8 @@ where_is_shmfs (void)
> while ((mp = __getmntent_r (fp, &resmem, buf, sizeof buf)) != NULL)
> /* The original name is "shm" but this got changed in early Linux
> 2.4.x to "tmpfs". */
> - if (strcmp (mp->mnt_type, "tmpfs") == 0)
> + if (strcmp (mp->mnt_type, "tmpfs") == 0
> + || strcmp (mp->mnt_type, "shm") == 0)
> {
> /* Found it. There might be more than one place where the
> filesystem is mounted but one is enough for us. */
> @@ -95,7 +97,8 @@ where_is_shmfs (void)
> /* First make sure this really is the correct entry. At least
> some versions of the kernel give wrong information because
> of the implicit mount of the shmfs for SysV IPC. */
> - if (__statfs (mp->mnt_dir, &f) != 0 || f.f_type != SHMFS_SUPER_MAGIC)
> + if (__statfs (mp->mnt_dir, &f) != 0 || (f.f_type != SHMFS_SUPER_MAGIC &&
> + f.f_type != RAMFS_MAGIC))
Incorrect formatting - the && should come down on the next line and
align with the inner bracket.
Siddhesh
> continue;
>
> namelen = strlen (mp->mnt_dir);
> --
> 1.8.4.3
>