提交 35c3c629 编写于 作者: H Holger Eitzenberger 提交者: Junio C Hamano

[PATCH] git_mkstemp() fix

git_mkstemp() attempted to use TMPDIR environment variable, but it botched
copying the templates.

[jc: Holger, please add your own Signed-off-by line, and also if you can,
send in future patches as non attachments.]
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 affa40d2
......@@ -68,8 +68,13 @@ int git_mkstemp(char *path, size_t len, const char *template)
if ((env = getenv("TMPDIR")) == NULL) {
strcpy(pch, "/tmp/");
len -= 5;
} else
len -= snprintf(pch, len, "%s/", env);
pch += 5;
} else {
size_t n = snprintf(pch, len, "%s/", env);
len -= n;
pch += n;
}
safe_strncpy(pch, template, len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册