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

[PATCH 1/1] git: use git_mkstemp() instead of mkstemp()

From
HEHolger Eitzenberger <holger@my-eitzenberger.de>
Date
Aug 4, 2005, 20:49 UTC
Message-ID
<42F27F6D.5070903@my-eitzenberger.de>
prep_temp_blob: use git_mkstemp() instead of mkstemp()
/holger
prep_temp_blob: use git_mkstemp() instead of mkstemp()

--- commit 43bac92063c8dd8d88b33cb838530d4bb3dcad25 tree aeb8bdc2aa285df1fc4888e66fe88b4a8a5e2b3b parent 1a1f2cb5c27ed26e6ef8dd34209e561bdf256c22 author Holger Eitzenberger <holger@my-eitzenberger.de> Thu, 04 Aug 2005 22:30:43 +0200 committer Holger Eitzenberger <holger@elmo.intranet.astaro.de> Thu, 04 Aug 2005 22:30:43 +0200

 diff.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/diff.c b/diff.c
--- a/diff.c
+++ b/diff.c
@@ -41,11 +41,13 @@ static const char *external_diff(void)
 	return external_diff_cmd;
 }
 
+#define TEMPFILE_PATH_LEN		50
+
 static struct diff_tempfile {
 	const char *name; /* filename external diff should read from */
 	char hex[41];
 	char mode[10];
-	char tmp_path[50];
+	char tmp_path[TEMPFILE_PATH_LEN];
 } diff_temp[2];
 
 static int count_lines(const char *filename)
@@ -421,8 +423,7 @@ static void prep_temp_blob(struct diff_t
 {
 	int fd;
 
-	strcpy(temp->tmp_path, ".diff_XXXXXX");
-	fd = mkstemp(temp->tmp_path);
+	fd = git_mkstemp(temp->tmp_path, TEMPFILE_PATH_LEN, ".diff_XXXXXX");
 	if (fd < 0)
 		die("unable to create temp-file");
 	if (write(fd, blob, size) != size)
Message 1 of 1 in “git: use git_mkstemp() instead of mkstemp()”
  1. 1/1 git: use git_mkstemp() instead of mkstemp()Holger Eitzenberger, Aug 4, 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.