When following symlinks to the real executable, use a loop so a

symlink to a symlink can work.
(Jack)
This commit is contained in:
Guido van Rossum 1998-04-29 21:07:06 +00:00
parent 91eeefdee4
commit 302be44e96
1 changed files with 2 additions and 1 deletions

View File

@ -437,7 +437,7 @@ calculate_path()
{
char tmpbuffer[MAXPATHLEN+1];
int linklen = readlink(progpath, tmpbuffer, MAXPATHLEN);
if (linklen != -1) {
while (linklen != -1) {
/* It's not null terminated! */
tmpbuffer[linklen] = '\0';
if (tmpbuffer[0] == SEP)
@ -447,6 +447,7 @@ calculate_path()
reduce(argv0_path);
joinpath(argv0_path, tmpbuffer);
}
linklen = readlink(argv0_path, tmpbuffer, MAXPATHLEN);
}
}
#endif /* HAVE_READLINK */