1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00

Fix MS-Windows build following last change

* src/emacs.c (real_filename) [WINDOWSNT]: Fix off-by-one error
when allocating storage for a file name.
This commit is contained in:
Eli Zaretskii 2021-04-14 17:28:19 +03:00
parent 0c1fc9d581
commit 95dd6bb080

View File

@ -450,16 +450,14 @@ real_filename (char *filename)
#ifdef WINDOWSNT #ifdef WINDOWSNT
/* w32_my_exename resolves symlinks internally, so no need to /* w32_my_exename resolves symlinks internally, so no need to
call realpath. */ call realpath. */
real_name = xmalloc (strlen (filename)); real_name = xstrdup (filename);
strcpy (real_name, filename);
return real_name;
#else #else
real_name = realpath (filename, NULL); real_name = realpath (filename, NULL);
if (!real_name) if (!real_name)
fatal ("could not resolve realpath of \"%s\": %s", fatal ("could not resolve realpath of \"%s\": %s",
filename, strerror (errno)); filename, strerror (errno));
return real_name;
#endif #endif
return real_name;
} }
/* Set `invocation-name' `invocation-directory'. */ /* Set `invocation-name' `invocation-directory'. */