The following reply was made to PR misc/169023; it has been noted by GNATS.

From: "Jukka A. Ukkonen" <[email protected]>
To: [email protected], [email protected]
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--
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to