[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] save-cwd: don't leak a file descriptor when the caller execs
From: |
Eric Blake |
Subject: |
Re: [PATCH] save-cwd: don't leak a file descriptor when the caller execs. |
Date: |
Mon, 29 Mar 2010 10:21:49 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3 |
On 03/29/2010 03:49 AM, James Youngman wrote:
> Signed-off-by: James Youngman <address@hidden>
> ---
> ChangeLog | 7 +++++++
> lib/save-cwd.c | 2 ++
> modules/save-cwd | 1 +
> 3 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index dca5a12..f9bd220 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,10 @@
> +2010-03-28 James Youngman <address@hidden>
> +
> + save-cwd: don't leak a file descriptor when the caller execs.
> + * lib/save-cwd.c (save_cwd): set the close-on-exec flag for the
> + saved file descriptor.
> + * modules/save-cwd (Depends-on): Depend on cloexec.
Nice catch. Ultimately, though, it would be even nicer to guarantee
that we can do open (".", O_RDONLY | O_CLOEXEC), rather than having to
drag in "cloexec.h"; it is more efficient on POSIX 2008 systems.
[this email exists more as a reminder for when I get around to making
O_CLOEXEC work, than as a criticism of your patch]
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature