From: Guido van Rossum Date: Wed, 29 Apr 1998 21:07:06 +0000 (+0000) Subject: When following symlinks to the real executable, use a loop so a X-Git-Tag: v1.5.2a1~770 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=302be44e96f1bef7429192f0a6dcdccd63257942;p=python When following symlinks to the real executable, use a loop so a symlink to a symlink can work. (Jack) --- diff --git a/Modules/getpath.c b/Modules/getpath.c index 589b7aec4f..09b795d5c5 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 */