git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] lock_ref_sha1_basic does not remove empty directories on BSD

From
DSDennis Stosberg <dennis@stosberg.net>
Date
Oct 2, 2006, 17:23 UTC
Message-ID
<20061002172353.G44b12bbc@leonov.stosberg.net>

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>
---
 refs.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/refs.c b/refs.c
index aa4c4e0..305c1a9 100644
--- a/refs.c
+++ b/refs.c
@@ -234,6 +234,12 @@ const char *resolve_ref(const char *ref,
 			}
 		}
 
+		/* Is it a directory? */
+		if (S_ISDIR(st.st_mode)) {
+			errno = EISDIR;
+			return NULL;
+		}
+
 		/*
 		 * Anything else, just open it and try to use it as
 		 * a ref
-- 
1.4.2
Next: Junio C Hamano
Message 1 of 2 in “lock_ref_sha1_basic does not remove empty directories on BSD”
  1. lock_ref_sha1_basic does not remove empty directories on BSDDennis Stosberg, Oct 2, 2006
  2. Junio C HamanoOct 3, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.