Date: Thu, 14 Jun 2012 05:40:03 GMT From: "Jukka A. Ukkonen" <jau@oxit.fi> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/169023: setfsent(), getfsent(), etc. leave /etc/fstab open after exec() Message-ID: <201206140540.q5E5e33x008715@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/169023; it has been noted by GNATS. From: "Jukka A. Ukkonen" <jau@oxit.fi> To: bug-followup@FreeBSD.org, jau@iki.fi Cc: Subject: Re: misc/169023: setfsent(), getfsent(), etc. leave /etc/fstab open after exec() Date: Thu, 14 Jun 2012 08:34:06 +0300 This is a multi-part message in MIME format. --------------090001050406070603010704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit A better version of the same patch which now uses _fcntl() instead of plain fcntl(). --------------090001050406070603010704 Content-Type: text/plain; charset=UTF-8; name="setfsent-cloexec.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="setfsent-cloexec.patch" --- lib/libc/gen/fstab.c.orig 2012-04-17 14:54:01.000000000 +0300 +++ lib/libc/gen/fstab.c 2012-06-14 07:30:23.000000000 +0300 @@ -45,6 +45,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <fcntl.h> #include "un-namespace.h" static FILE *_fs_fp; @@ -258,6 +259,11 @@ setfstab(getenv("PATH_FSTAB")); } if ((_fs_fp = fopen(path_fstab, "r")) != NULL) { + int fd; + + fd = fileno (_fs_fp); + (void) _fcntl (fd, F_SETFD, FD_CLOEXEC); + LineNo = 0; return(1); } --------------090001050406070603010704--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206140540.q5E5e33x008715>