1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00

shm_open: sync with logic in sem_open

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Mike Frysinger
2014-01-23 01:16:14 -05:00
parent 6fc8123f48
commit d674667cba
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2014-02-08 Mike Frysinger <vapier@gentoo.org>
* sysdeps/unix/sysv/linux/shm_open.c (where_is_shmfs): Compare
f.f_type to RAMFS_MAGIC too. Compare mp->mnt_type to shm too.
2014-02-08 Mike Frysinger <vapier@gentoo.org> 2014-02-08 Mike Frysinger <vapier@gentoo.org>
* manual/setjmp.texi: Fix typos/grammar errors. * manual/setjmp.texi: Fix typos/grammar errors.

View File

@ -62,7 +62,8 @@ where_is_shmfs (void)
/* The canonical place is /dev/shm. This is at least what the /* The canonical place is /dev/shm. This is at least what the
documentation tells everybody to do. */ 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))
{ {
/* It is in the normal place. */ /* It is in the normal place. */
mountpoint.dir = (char *) defaultdir; mountpoint.dir = (char *) defaultdir;
@ -86,7 +87,8 @@ where_is_shmfs (void)
while ((mp = __getmntent_r (fp, &resmem, buf, sizeof buf)) != NULL) while ((mp = __getmntent_r (fp, &resmem, buf, sizeof buf)) != NULL)
/* The original name is "shm" but this got changed in early Linux /* The original name is "shm" but this got changed in early Linux
2.4.x to "tmpfs". */ 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 /* Found it. There might be more than one place where the
filesystem is mounted but one is enough for us. */ 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 /* First make sure this really is the correct entry. At least
some versions of the kernel give wrong information because some versions of the kernel give wrong information because
of the implicit mount of the shmfs for SysV IPC. */ 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))
continue; continue;
namelen = strlen (mp->mnt_dir); namelen = strlen (mp->mnt_dir);