{"thread":{"id":"8243","subject":"[PATCH] Use PATH_MAX instead of TEMPFILE_PATH_LEN","startedAt":"2007-05-20T13:35:46Z","lastAt":"2007-05-20T13:35:46Z","messageCount":1,"participants":["Fernando J. Pereda"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"42710","messageId":"20070520133546.GA11935@ferdyx.org","threadId":"8243","inReplyTo":null,"subject":"[PATCH] Use PATH_MAX instead of TEMPFILE_PATH_LEN","fromName":"Fernando J. Pereda","fromEmail":"ferdy@gentoo.org","sentAt":"2007-05-20T13:35:46Z","receivedAt":"2007-05-20T13:35:46Z","isPatch":true,"sender":{"key":"ferdy@gentoo.org","avatar":null},"body":"Signed-off-by: Fernando J. Pereda <ferdy@gentoo.org>\n---\n\n\tIn Gentoo, packages compile with:\n\tTMPDIR=/var/tmp/portage/dev-util/git-1.5.2/temp\n\tso git_mkstemp couldn't fit the .diff_XXXXXX part and mkstemp was\n\treturning EINVAL.\n\n diff.c |    6 ++----\n 1 files changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 33297aa..b23e190 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -186,13 +186,11 @@ 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[TEMPFILE_PATH_LEN];\n+\tchar tmp_path[PATH_MAX];\n } diff_temp[2];\n \n static int count_lines(const char *data, int size)\n@@ -1561,7 +1559,7 @@ static void prep_temp_blob(struct diff_tempfile *temp,\n {\n \tint fd;\n \n-\tfd = git_mkstemp(temp->tmp_path, TEMPFILE_PATH_LEN, \".diff_XXXXXX\");\n+\tfd = git_mkstemp(temp->tmp_path, PATH_MAX, \".diff_XXXXXX\");\n \tif (fd < 0)\n \t\tdie(\"unable to create temp-file\");\n \tif (write_in_full(fd, blob, size) != size)\n-- \n1.5.2\n\n\n-- \nFernando J. Pereda Garcimartín\n20BB BDC3 761A 4781 E6ED  ED0B 0A48 5B0C 60BD 28D4\n"}]}