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
signature.asc
Description: OpenPGP digital signature