Skip to content

Commit 094c7e6

Browse files
j6tgitster
authored andcommitted
prune: close directory earlier during loose-object directory traversal
27e1e22 (prune: factor out loose-object directory traversal, 2014-10-16) introduced a new function for_each_loose_file_in_objdir() with a helper for_each_file_in_obj_subdir(). The latter calls callbacks for each file found during a directory traversal and finally also a callback for the directory itself. git-prune uses the function to clean up the object directory. In particular, in the directory callback it calls rmdir(). On Windows XP, this rmdir call fails, because the directory is still open while the callback is called. Close the directory before calling the callback. Signed-off-by: Johannes Sixt <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ee1c6c3 commit 094c7e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sha1_file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3356,12 +3356,12 @@ static int for_each_file_in_obj_subdir(int subdir_nr,
33563356
break;
33573357
}
33583358
}
3359-
strbuf_setlen(path, baselen);
3359+
closedir(dir);
33603360

3361+
strbuf_setlen(path, baselen);
33613362
if (!r && subdir_cb)
33623363
r = subdir_cb(subdir_nr, path->buf, data);
33633364

3364-
closedir(dir);
33653365
return r;
33663366
}
33673367

0 commit comments

Comments
 (0)