about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/shm_open.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-09 17:34:27 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-09 17:34:27 +0000
commit301909fbcb5314e7968824f69635387c50e53dbc (patch)
tree4f92702bc3c3cc6c79c4cf0874a1d1a1e1481151 /sysdeps/unix/sysv/linux/shm_open.c
parentb511d8fc6b63fc7555c88bd4ab7001dd3d51c3d1 (diff)
downloadglibc-301909fbcb5314e7968824f69635387c50e53dbc.tar.gz
glibc-301909fbcb5314e7968824f69635387c50e53dbc.tar.xz
glibc-301909fbcb5314e7968824f69635387c50e53dbc.zip
Update.
2000-06-09  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/shm_open.c (where_is_shmfs): Try harder
	to find correct mount point despite wrong information from the
	kernel.
Diffstat (limited to 'sysdeps/unix/sysv/linux/shm_open.c')
-rw-r--r--sysdeps/unix/sysv/linux/shm_open.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c
index 0cf7f5e0b3..271b92db61 100644
--- a/sysdeps/unix/sysv/linux/shm_open.c
+++ b/sysdeps/unix/sysv/linux/shm_open.c
@@ -38,7 +38,7 @@ static struct
 } mountpoint;
 
 /* This is the default directory.  */
-const char defaultdir[] = "/dev/shm/";
+static const char defaultdir[] = "/dev/shm/";
 
 /* Protect the `mountpoint' variable above.  */
 __libc_once_define (static, once);
@@ -82,7 +82,15 @@ where_is_shmfs (void)
       {
 	/* Found it.  There might be more than one place where the
            filesystem is mounted but one is enough for us.  */
-	size_t namelen = strlen (mp->mnt_dir);
+	size_t namelen;
+
+	/* 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)
+	  continue;
+
+	namelen = strlen (mp->mnt_dir);
 
 	if (namelen == 0)
 	  /* Hum, maybe some crippled entry.  Keep on searching.  */