[PATCH] Apply bugfixes and suggestions from Eric's comments.

2010-03-29 Thread James Youngman
* configure.ac: Check for and the getrusage function. * lib/fdleak.c: Don't #include if we don't have it. (get_max_fd): If neither /proc/self/fd not getrusage is available, return _POSIX_OPEN_MAX. (remember_non_cloexec_fds): Also check for leaks in file descriptors 0, 1, 2, just in case the calle

Re: [Findutils-patches] [PATCH] Fix file descriptor leaks.

2010-03-29 Thread James Youngman
On Mon, Mar 29, 2010 at 11:01 PM, Eric Blake wrote: > Or you could just update to today's gnulib, where your upstream patch > doing the same thing was accepted. Done, in the pushed version. > I find mid-expression #ifdefs hard to read.  Better is to do this at > file scope: > > #ifndef O_CLOEXEC

[bug #27375] find leaks fds to child processes

2010-03-29 Thread James Youngman
Update of bug #27375 (project findutils): Status: Confirmed => Fixed Assigned to: ericb => jay ___ Follow-up Comment #3: Fixed in 4.5.x (

Re: [Findutils-patches] [PATCH] Fix file descriptor leaks.

2010-03-29 Thread Eric Blake
On 03/29/2010 04:01 PM, Eric Blake wrote: >> * gnulib-local/lib/save-cwd.c.diff: Patch gnulib to set FD_CLOEXEC >> on the file descriptors opened by save_cwd. > > Or you could just update to today's gnulib, where your upstream patch > doing the same thing was accepted. > > I tried testing with yo

Re: [Findutils-patches] [PATCH] Fix file descriptor leaks.

2010-03-29 Thread Eric Blake
On 03/29/2010 04:29 AM, James Youngman wrote: > +int > +open_cloexec (const char *path, int flags) > +{ > + int fd; > + One more thing I just thought of: it would be wise to add: assert ((flags & O_CREAT) == 0); > + fd = open (path, flags > +#if defined O_CLOEXEC > + |O_CLOEXEC > +#en

Re: [Findutils-patches] [PATCH] Fix file descriptor leaks.

2010-03-29 Thread Eric Blake
On 03/29/2010 04:29 AM, James Youngman wrote: > * import-gnulib.config (gnulib_version): Update to more recent > version of gnulib. Import the cloexec module too. > * lib/fdleak.c: New file; a module for detecting file descriptor > leaks. Also define an open_cloexec() function. Hmm - I really s

[bug #27375] find leaks fds to child processes

2010-03-29 Thread James Youngman
Follow-up Comment #2, bug #27375 (project findutils): The attached patch should fix the problem and include a self-test (though it's not a regression test). (file #20064) ___ Additional Item Attachment: File name: 0001-Fix-file-descripto

[PATCH] Fix file descriptor leaks.

2010-03-29 Thread James Youngman
* import-gnulib.config (gnulib_version): Update to more recent version of gnulib. Import the cloexec module too. * lib/fdleak.c: New file; a module for detecting file descriptor leaks. Also define an open_cloexec() function. * lib/fdleak.h: Declare the global functions defined in fdleak.c. * lib