On 01/07/2013 05:20 PM, Aaron Burgemeister wrote: > <http://savannah.gnu.org/bugs/?34976>
The following fixes the issue. Unfortunately, the test-suite is not very comprehensive, so I can't tell 100% if it is free of side effects. Comments? Have a nice day, Berny >From 3a645ef225776b77657c9da6dae382b9205d0bd0 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker <m...@bernhard-voelker.de> Date: Mon, 7 Jan 2013 19:22:06 +0100 Subject: [PATCH] find: fix fd leak with --execdir option (bug#34976) Prevent "Failed to save working dir[...]: Too many open files" error by closing the directories file descriptor. * find/exec.c (impl_pred_exec): Free the working directory if find executes the command in the local dir, i.e. if it has been saved by record_exec_dir(). --- find/exec.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/find/exec.c b/find/exec.c index b83131d..27919c1 100644 --- a/find/exec.c +++ b/find/exec.c @@ -212,6 +212,8 @@ impl_pred_exec (const char *pathname, { result = false; } + if (local) + free_cwd (execp->wd_for_exec); } if (buf) { -- 1.7.7