From: Aaron Sethman Subject: Re: [Openvpn-devel] Opened file descriptors in script calls In-Reply-To: <200302111711.h1BHBbf18506@...41...> Message-ID: References: <200302111711.h1BHBbf18506@...41...> MIME-Version: 1.0 Sender: openvpn-devel-admin@lists.sourceforge.net Errors-To: openvpn-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Id: List-Unsubscribe: , List-Archive: Date: Tue Feb 11 09:19:10 2003 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Transfer-Encoding: 8bit To: James Yonan Cc: Alberto Gonzalez Iniesta , openvpn-devel@lists.sourceforge.net On Tue, 11 Feb 2003, James Yonan wrote: > /* Set a file descriptor to not be passed across execs */ > void > set_cloexec (int fd) > { > if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) > msg (M_ERR, "Set file descriptor to FD_CLOEXEC failed"); > } > > Just set the FD_CLOEXEC flag on the fd and it won't be passed across the exec > that runs the shell. That works even better then :) Regards, Aaron