bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a minor bug


From: Eric Blake
Subject: Re: a minor bug
Date: Tue, 10 Nov 2015 09:29:26 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 11/06/2015 10:31 PM, Kyle Sallee wrote:
> By xargs a file descriptor is leaked.
> Within find; the omission might or might not exist.
> A patch is attached.
> 
> 
> findutils-4.4.2.o_cloexec.patch
> 
> 
> diff -r -U2 findutils-4.4.2/xargs/xargs.c findutils-4.4.2/xargs/xargs.c
> --- findutils-4.4.2/xargs/xargs.c     0000-00-00 00:00:00.000000000 -0000
> +++ findutils-4.4.2/xargs/xargs.c     0000-00-00 00:00:00.000000000 -0000
> @@ -647,5 +647,5 @@
>      {
>        keep_stdin = 1;                /* see prep_child_for_exec() */
> -      input_stream = fopen (input_file, "r");
> +      input_stream = fopen (input_file, "re");

fopen(,"re") is not (yet) POSIX; we'd have to guarantee that it is first
supported by gnulib before we could rely on it.  But the idea of marking
fds close-on-exec in xargs so that they are not leaked to the child
process makes sense.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]