This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
open_temp_exec_file_mnt bug with getmntent_r
- From: Mark Wielaard <mjw at redhat dot com>
- To: libffi-discuss at sourceware dot org
- Date: Fri, 20 Aug 2010 13:05:02 +0200
- Subject: open_temp_exec_file_mnt bug with getmntent_r
Hi,
Probably nobody noticed before because earlier open_temp_exec_file_opts
(TMPDIR, /tmp, /var/tmp, /dev/shm, HOME) always allow creating files.
But if you have a weird setup that doesn't, then the
open_temp_exec_file_mnt mount point search won't help you because the
getmntent_r () return check is wrong. It fails when an entry is found
instead of when no entry is found (NULL is returned).
This fixes that case:
2010-08-20 Mark Wielaard <mjw@redhat.com>
* src/closures.c (open_temp_exec_file_mnt): Check if getmntent_r
returns NULL.
You can also test this by commenting out the earlier
open_temp_exec_file_opts options.
Cheers,
Mark
>From 486743a58272932983ee544b6fb80e2adbaa2879 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Fri, 20 Aug 2010 13:01:09 +0200
Subject: [PATCH] Fix open_temp_exec_file_mnt getmntent_r return value check.
---
ChangeLog | 5 +++++
src/closures.c | 2 +-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5768c10..2ad9240 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-20 Mark Wielaard <mjw@redhat.com>
+
+ * src/closures.c (open_temp_exec_file_mnt): Check if getmntent_r
+ returns NULL.
+
2010-08-05 Dan Witte <dwitte@mozilla.com>
* Makefile.am: Pass FFI_DEBUG define to msvcc.sh for linking to the
diff --git a/src/closures.c b/src/closures.c
index 8f295dd..d7b338b 100644
--- a/src/closures.c
+++ b/src/closures.c
@@ -294,7 +294,7 @@ open_temp_exec_file_mnt (const char *mounts)
struct mntent mnt;
char buf[MAXPATHLEN * 3];
- if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf)))
+ if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf)) == NULL)
return -1;
if (hasmntopt (&mnt, "ro")
--
1.7.1