Skip to content

Commit 86ec5c6

Browse files
authored
bpo-38353: Fix calculate_argv0_path() for symlinks (GH-16549)
calculate_argv0_path() must read argv0_path link, not read program_full_path link.
1 parent b23a842 commit 86ec5c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/getpath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ calculate_argv0_path(PyCalculatePath *calculate, const wchar_t *program_full_pat
959959
#if HAVE_READLINK
960960
wchar_t tmpbuffer[MAXPATHLEN + 1];
961961
const size_t buflen = Py_ARRAY_LENGTH(tmpbuffer);
962-
int linklen = _Py_wreadlink(program_full_path, tmpbuffer, buflen);
962+
int linklen = _Py_wreadlink(argv0_path, tmpbuffer, buflen);
963963
while (linklen != -1) {
964964
if (_Py_isabs(tmpbuffer)) {
965965
/* tmpbuffer should never be longer than MAXPATHLEN,

0 commit comments

Comments
 (0)