summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-10-03 21:17:00 (GMT)
committerGitHub <noreply@github.com>2019-10-03 21:17:00 (GMT)
commit86ec5c65fe04ece16f3aada5292cc62726062ad0 (patch)
tree5e96ac514f12f4b755106289170a7eee79e8f86d
parentb23a8423a923077e4f83d3f328bb7542b4c940ed (diff)
downloadcpython-86ec5c65fe04ece16f3aada5292cc62726062ad0.zip
cpython-86ec5c65fe04ece16f3aada5292cc62726062ad0.tar.gz
cpython-86ec5c65fe04ece16f3aada5292cc62726062ad0.tar.bz2
bpo-38353: Fix calculate_argv0_path() for symlinks (GH-16549)
calculate_argv0_path() must read argv0_path link, not read program_full_path link.
-rw-r--r--Modules/getpath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 4246d4c..fca87c7 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -959,7 +959,7 @@ calculate_argv0_path(PyCalculatePath *calculate, const wchar_t *program_full_pat
#if HAVE_READLINK
wchar_t tmpbuffer[MAXPATHLEN + 1];
const size_t buflen = Py_ARRAY_LENGTH(tmpbuffer);
- int linklen = _Py_wreadlink(program_full_path, tmpbuffer, buflen);
+ int linklen = _Py_wreadlink(argv0_path, tmpbuffer, buflen);
while (linklen != -1) {
if (_Py_isabs(tmpbuffer)) {
/* tmpbuffer should never be longer than MAXPATHLEN,