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

View file

@ -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 */