git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Do _not_ call unlink on a directory
@ 2007-07-16 17:12 Thomas Glanzmann
  2007-07-16 17:18 ` Matthieu Moy
                   ` (4 more replies)
  0 siblings, 5 replies; 30+ messages in thread
From: Thomas Glanzmann @ 2007-07-16 17:12 UTC (permalink / raw)
  To: git, gitster; +Cc: Thomas Glanzmann

Calling unlink on a directory on a Solaris UFS filesystem as root makes it
inconsistent. Thanks to Johannes Sixt for the obvious fix.
---
 entry.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/entry.c b/entry.c
index 82bf725..1f2e34d 100644
--- a/entry.c
+++ b/entry.c
@@ -14,10 +14,10 @@ static void create_directories(const char *path, const struct checkout *state)
 		if (mkdir(buf, 0777)) {
 			if (errno == EEXIST) {
 				struct stat st;
-				if (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0777))
-					continue;
 				if (!stat(buf, &st) && S_ISDIR(st.st_mode))
 					continue; /* ok */
+				if (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0777))
+					continue;
 			}
 			die("cannot create directory at %s", buf);
 		}
-- 
1.5.2.1

^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2007-07-18  8:50 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-16 17:12 [PATCH] Do _not_ call unlink on a directory Thomas Glanzmann
2007-07-16 17:18 ` Matthieu Moy
2007-07-16 19:05   ` Scott Lamb
2007-07-16 19:56     ` Thomas Glanzmann
2007-07-16 20:00     ` Thomas Glanzmann
2007-07-16 20:21       ` Linus Torvalds
2007-07-16 20:25         ` Thomas Glanzmann
2007-07-16 20:34           ` Linus Torvalds
2007-07-16 20:39             ` Thomas Glanzmann
2007-07-16 21:23             ` Scott Lamb
2007-07-16 21:44               ` Linus Torvalds
2007-07-16 21:58                 ` Scott Lamb
2007-07-16 22:03                   ` Linus Torvalds
2007-07-16 20:29         ` Linus Torvalds
2007-07-16 17:38 ` Thomas Glanzmann
2007-07-16 17:41   ` Jan-Benedict Glaw
2007-07-16 17:42   ` Brian Downing
2007-07-16 17:55     ` Thomas Glanzmann
2007-07-16 19:58 ` Linus Torvalds
2007-07-16 21:06   ` Brian Downing
2007-07-16 21:19     ` Linus Torvalds
2007-07-17  8:58   ` David Kastrup
2007-07-17  7:30 ` Junio C Hamano
2007-07-17  8:28 ` Junio C Hamano
2007-07-17 10:15   ` Thomas Glanzmann
2007-07-17 18:34     ` Junio C Hamano
2007-07-17 20:27       ` Thomas Glanzmann
2007-07-18  7:24         ` Johannes Sixt
2007-07-18  8:50           ` Thomas Glanzmann
2007-07-17 19:07   ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).