summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-07-26 04:34:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-07-26 04:34:53 (GMT)
commite7a7be8831b159b9a7331b34c3ec6915d4a72190 (patch)
tree18f6cb3d3977ddc13a2e196eb1357885c6aa2079 /diff.c
parentd58e8d34b019d435b424811c6f972910dfac6f55 (diff)
downloadgit-e7a7be8831b159b9a7331b34c3ec6915d4a72190.zip
git-e7a7be8831b159b9a7331b34c3ec6915d4a72190.tar.gz
git-e7a7be8831b159b9a7331b34c3ec6915d4a72190.tar.bz2
git_mkstemp(): be careful not to overflow the path buffer.
If user's TMPDIR is insanely long, return negative after setting errno to ENAMETOOLONG, pretending that the underlying mkstemp() choked on a temporary file path that is too long. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index cd6b0c4..a5fc56b 100644
--- a/diff.c
+++ b/diff.c
@@ -1695,7 +1695,7 @@ static void prep_temp_blob(struct diff_tempfile *temp,
fd = git_mkstemp(temp->tmp_path, PATH_MAX, ".diff_XXXXXX");
if (fd < 0)
- die("unable to create temp-file");
+ die("unable to create temp-file: %s", strerror(errno));
if (write_in_full(fd, blob, size) != size)
die("unable to write temp-file");
close(fd);