mirror of
https://github.com/python/cpython.git
synced 2025-12-09 02:35:14 +00:00
When following symlinks to the real executable, use a loop so a
symlink to a symlink can work. (Jack)
This commit is contained in:
parent
91eeefdee4
commit
302be44e96
1 changed files with 2 additions and 1 deletions
|
|
@ -437,7 +437,7 @@ calculate_path()
|
||||||
{
|
{
|
||||||
char tmpbuffer[MAXPATHLEN+1];
|
char tmpbuffer[MAXPATHLEN+1];
|
||||||
int linklen = readlink(progpath, tmpbuffer, MAXPATHLEN);
|
int linklen = readlink(progpath, tmpbuffer, MAXPATHLEN);
|
||||||
if (linklen != -1) {
|
while (linklen != -1) {
|
||||||
/* It's not null terminated! */
|
/* It's not null terminated! */
|
||||||
tmpbuffer[linklen] = '\0';
|
tmpbuffer[linklen] = '\0';
|
||||||
if (tmpbuffer[0] == SEP)
|
if (tmpbuffer[0] == SEP)
|
||||||
|
|
@ -447,6 +447,7 @@ calculate_path()
|
||||||
reduce(argv0_path);
|
reduce(argv0_path);
|
||||||
joinpath(argv0_path, tmpbuffer);
|
joinpath(argv0_path, tmpbuffer);
|
||||||
}
|
}
|
||||||
|
linklen = readlink(argv0_path, tmpbuffer, MAXPATHLEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAVE_READLINK */
|
#endif /* HAVE_READLINK */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue