Date: Thu, 14 Jun 2012 05:30:10 GMT From: "Jukka A. Ukkonen" <jau@oxit.fi> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/80798: mount_portal pipe leaves file descriptors open for child processes Message-ID: <201206140530.q5E5UAmP097679@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/80798; it has been noted by GNATS. From: "Jukka A. Ukkonen" <jau@oxit.fi> To: bug-followup@FreeBSD.org, hohmuth@sax.de Cc: Subject: Re: bin/80798: mount_portal pipe leaves file descriptors open for child processes Date: Thu, 14 Jun 2012 08:28:45 +0300 This is a multi-part message in MIME format. --------------050707020708060501030604 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To properly fix the anomaly (not just a workaround) only closing those couple of extra file descriptors at exec() apply the attached patch to stop leaking the socket to /tmp/portalXXXXXXXXX and the patch to the separate PR http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/80798 which plugs the leak of a descriptor to /etc/fstab. --jau --------------050707020708060501030604 Content-Type: text/plain; charset=UTF-8; name="mount_portalfs.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mount_portalfs.patch" --- usr.sbin/mount_portalfs/mount_portalfs.c.orig 2012-06-14 07:52:20.000000000 +0300 +++ usr.sbin/mount_portalfs/mount_portalfs.c 2012-06-14 08:07:54.000000000 +0300 @@ -58,6 +58,7 @@ #include <string.h> #include <sysexits.h> #include <unistd.h> +#include <fcntl.h> #include "mntopts.h" #include "pathnames.h" @@ -167,6 +168,8 @@ (void) listen(so, 5); + (void) fcntl (so, F_SETFD, FD_CLOEXEC); + args.pa_socket = so; sprintf(tag, "portal:%d", getpid()); args.pa_config = tag; @@ -260,6 +263,9 @@ break; case 0: (void) close(so); + + (void) fcntl (so2, F_SETFD, FD_CLOEXEC); + activate(&q, so2); exit(0); default: --------------050707020708060501030604--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206140530.q5E5UAmP097679>