bug-gnulib
[Top][All Lists]
Advanced

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

Re: a minor bug


From: Kyle Sallee
Subject: Re: a minor bug
Date: Tue, 10 Nov 2015 09:04:25 -0800

A POSIX compliant fclose the leak patch is attached.

On Tue, Nov 10, 2015 at 8:29 AM, Eric Blake <address@hidden> wrote:
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: findutils-4.4.2-fclose_leak.patch
Description: Binary data


reply via email to

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