summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-04-29 21:07:06 (GMT)
committerGuido van Rossum <guido@python.org>1998-04-29 21:07:06 (GMT)
commit302be44e96f1bef7429192f0a6dcdccd63257942 (patch)
treefa13998c2d5bd2e50c1786cd90146d35cbf44efb /Modules
parent91eeefdee41dcf08f4fd6b16f6ce7e9758ab4724 (diff)
downloadcpython-302be44e96f1bef7429192f0a6dcdccd63257942.zip
cpython-302be44e96f1bef7429192f0a6dcdccd63257942.tar.gz
cpython-302be44e96f1bef7429192f0a6dcdccd63257942.tar.bz2
When following symlinks to the real executable, use a loop so a
symlink to a symlink can work. (Jack)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/getpath.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 589b7ae..09b795d 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -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 */