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

[PATCH 1/1] git_mkstemp() fix

From
HEHolger Eitzenberger <holger@my-eitzenberger.de>
Date
Aug 8, 2005, 20:33 UTC
Message-ID
<42F7C184.1000902@my-eitzenberger.de>
Hi,
attached is a bugfix for the newly introduced git_mkstemp() function.
/holger
git_mkstemp() bugfix

--- commit 8cccfa75e0095afd2dd4ec354f2786068c9e7a2f tree 354e00b03039e0c42284442c9764dcd3bf8f608f parent d59a6043a8a7aed97c684fb4f14fe5221df1fcaf author Holger Eitzenberger <holger@my-eitzenberger.de> Mon, 08 Aug 2005 23:29:28 +0200 committer Holger Eitzenberger <holger@jonathan.my-eitzenberger.de> Mon, 08 Aug 2005 23:29:28 +0200

 path.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/path.c b/path.c
--- a/path.c
+++ b/path.c
@@ -68,8 +68,13 @@ int git_mkstemp(char *path, size_t len, 
 	if ((env = getenv("TMPDIR")) == NULL) {
 		strcpy(pch, "/tmp/");
 		len -= 5;
-	} else
-		len -= snprintf(pch, len, "%s/", env);
+		pch += 5;
+	} else {
+		size_t n = snprintf(pch, len, "%s/", env);
+
+		len -= n;
+		pch += n;
+	}
 
 	safe_strncpy(pch, template, len);
 
Message 1 of 1 in “git_mkstemp() fix”
  1. 1/1 git_mkstemp() fixHolger Eitzenberger, Aug 8, 2005

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.