{"thread":{"id":"1421","subject":"[PATCH 1/1] git: use git_mkstemp() instead of mkstemp()","startedAt":"2005-08-04T20:49:49Z","lastAt":"2005-08-04T20:49:49Z","messageCount":1,"participants":["Holger Eitzenberger"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"6824","messageId":"42F27F6D.5070903@my-eitzenberger.de","threadId":"1421","inReplyTo":null,"subject":"[PATCH 1/1] git: use git_mkstemp() instead of mkstemp()","fromName":"Holger Eitzenberger","fromEmail":"holger@my-eitzenberger.de","sentAt":"2005-08-04T20:49:49Z","receivedAt":"2005-08-04T20:49:49Z","isPatch":true,"sender":{"key":"holger@my-eitzenberger.de","avatar":null},"body":"prep_temp_blob: use git_mkstemp() instead of mkstemp()\n\n/holger\n\n\nprep_temp_blob: use git_mkstemp() instead of mkstemp()\n\n---\ncommit 43bac92063c8dd8d88b33cb838530d4bb3dcad25\ntree aeb8bdc2aa285df1fc4888e66fe88b4a8a5e2b3b\nparent 1a1f2cb5c27ed26e6ef8dd34209e561bdf256c22\nauthor Holger Eitzenberger <holger@my-eitzenberger.de> Thu, 04 Aug 2005 22:30:43 +0200\ncommitter Holger Eitzenberger <holger@elmo.intranet.astaro.de> Thu, 04 Aug 2005 22:30:43 +0200\n\n diff.c |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/diff.c b/diff.c\n--- a/diff.c\n+++ b/diff.c\n@@ -41,11 +41,13 @@ static const char *external_diff(void)\n \treturn external_diff_cmd;\n }\n \n+#define TEMPFILE_PATH_LEN\t\t50\n+\n static struct diff_tempfile {\n \tconst char *name; /* filename external diff should read from */\n \tchar hex[41];\n \tchar mode[10];\n-\tchar tmp_path[50];\n+\tchar tmp_path[TEMPFILE_PATH_LEN];\n } diff_temp[2];\n \n static int count_lines(const char *filename)\n@@ -421,8 +423,7 @@ static void prep_temp_blob(struct diff_t\n {\n \tint fd;\n \n-\tstrcpy(temp->tmp_path, \".diff_XXXXXX\");\n-\tfd = mkstemp(temp->tmp_path);\n+\tfd = git_mkstemp(temp->tmp_path, TEMPFILE_PATH_LEN, \".diff_XXXXXX\");\n \tif (fd < 0)\n \t\tdie(\"unable to create temp-file\");\n \tif (write(fd, blob, size) != size)\n"}]}