@matheusbsbs / matheus-bagliano / commits / 7a21632fa3
Fork 0

lock_ref_sha1_basic does not remove empty directories on BSD

lock_ref_sha1_basic relies on errno beeing set to EISDIR by the call to read() in resolve_ref() to detect directories. But calling read() on a directory under NetBSD returns EPERM, and even succeeds for local filesystems on FreeBSD. Signed-off-by: Dennis Stosberg <dennis@stosberg.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Dennis Stosberg committed Oct 2, 2006 at 19:23 UTC 7a21632fa346df58d94d32f09625025931ef13ec
1 file changed +6
refs.c
+6
@@ -42,6 +42,12 @@ const char *resolve_ref(const char *path, unsigned char *sha1, int reading)
42 }
43 }
44
45 + /* Is it a directory? */
46 + if (S_ISDIR(st.st_mode)) {
47 + errno = EISDIR;
48 + return NULL;
49 + }
50 +
51 /*
52 * Anything else, just open it and try to use it as
53 * a ref