mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-30 17:30:36 -05:00
mingw: do not call xutftowcs_path in mingw_mktemp
The `xutftowcs_path` function canonicalizes absolute paths using GetFullPathNameW. This canonicalization may change the length of the string (e.g. getting rid of \.\), which breaks callers that pass the template string in a strbuf and expect the length of the string to remain the same. In my particular case, the tmp-objdir code is passing a strbuf to mkdtemp and is breaking since the strbuf.len is no longer synchronized with strlen(strbuf.buf). Signed-off-by: Neeraj K. Singh <neerajsi@microsoft.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
80afdbd698
commit
875251fd73
@@ -1276,8 +1276,11 @@ char *mingw_mktemp(char *template)
|
|||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
/* we need to return the path, thus no long paths here! */
|
/* we need to return the path, thus no long paths here! */
|
||||||
if (xutftowcs_path(wtemplate, template) < 0)
|
if (xutftowcsn(wtemplate, template, MAX_PATH, -1) < 0) {
|
||||||
|
if (errno == ERANGE)
|
||||||
|
errno = ENAMETOOLONG;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_dir_sep(template[0]) && !is_dir_sep(template[1]) &&
|
if (is_dir_sep(template[0]) && !is_dir_sep(template[1]) &&
|
||||||
iswalpha(wtemplate[0]) && wtemplate[1] == L':') {
|
iswalpha(wtemplate[0]) && wtemplate[1] == L':') {
|
||||||
|
|||||||
Reference in New Issue
Block a user