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

[PATCH] prefix_path: use is_absolute_path() instead of *orig == '/'

From
Johannes Sixt <johannes.sixt@telecom.at>
Date
Feb 19, 2008, 21:29 UTC
Message-ID
<1203456580.47bb4a44b9d24@webmail.nextra.at>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
This goes on top of branch jc/setup.
-- Hannes
 setup.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.c b/setup.c
index 5e4cecb..18ddfae 100644
--- a/setup.c
+++ b/setup.c
@@ -91,7 +91,7 @@ const char *prefix_path(const char *prefix, int len,
 {
 	const char *orig = path;
 	char *sanitized = xmalloc(len + strlen(path) + 1);
-	if (*orig == '/')
+	if (is_absolute_path(orig))
 		strcpy(sanitized, path);
 	else {
 		if (len)
@@ -100,7 +100,7 @@ const char *prefix_path(const char *prefix, int len,
 	}
 	if (sanitary_path_copy(sanitized, sanitized))
 		goto error_out;
-	if (*orig == '/') {
+	if (is_absolute_path(orig)) {
 		const char *work_tree = get_git_work_tree();
 		size_t len = strlen(work_tree);
 		size_t total = strlen(sanitized) + 1;
-- 
1.5.4.2.940.g0f70f.dirty
Message 1 of 1 in “prefix_path: use is_absolute_path() instead of *orig == '/'”
  1. prefix_path: use is_absolute_path() instead of *orig == '/'Johannes Sixt, Feb 19, 2008

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.