This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: open_temp_exec_file_mnt bug with getmntent_r
On Fri, 2010-08-27 at 11:37 +0200, Mark Wielaard wrote:
> On Fri, 2010-08-20 at 13:05 +0200, Mark Wielaard wrote:
> > 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.
>
> Ping. Any comments?
Adding java-patches to see if anybody there thinks this is a good idea.
Attached patch is against gcc/libffi.
Cheers,
Mark
Index: src/closures.c
===================================================================
--- src/closures.c (revision 163797)
+++ src/closures.c (working copy)
@@ -294,7 +294,7 @@
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")
Index: ChangeLog
===================================================================
--- ChangeLog (revision 163797)
+++ ChangeLog (working copy)
@@ -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-09 Andreas Tobler <andreast@fgznet.ch>
* configure.ac: Add target powerpc64-*-freebsd*.