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

From: Holger Eitzenberger <[email-masked]>
Date: Thu, 04 Aug 2005 22:49:49 +0200

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 <[email-masked]> Thu, 04 Aug 2005 22:30:43 +0200
committer Holger Eitzenberger <[email-masked]> 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)