From 0235017eafa8dfc3a7353b7091ad5109d0beb7a5 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Fri, 1 Apr 2011 10:29:16 +0200 Subject: clean: unreadable directory may still be rmdir-able if it is empty As a last ditch effort, try rmdir(2) when we cannot read the directory to be removed. It may be an empty directory that we can remove without any permission, as long as we can modify its parent directory. Noticed by Linus. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dir.c') diff --git a/dir.c b/dir.c index 570b651a17..aa1a7181f6 100644 --- a/dir.c +++ b/dir.c @@ -1088,7 +1088,7 @@ int remove_dir_recursively(struct strbuf *path, int flag) dir = opendir(path->buf); if (!dir) - return -1; + return rmdir(path->buf); if (path->buf[original_len - 1] != '/') strbuf_addch(path, '/'); -- cgit v1.2.1