Commit affada9f authored by Guido van Rossum's avatar Guido van Rossum

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

symlink to a symlink can work.
(Jack)
parent 870d6fa6
...@@ -437,7 +437,7 @@ calculate_path() ...@@ -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() ...@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment