From 302be44e96f1bef7429192f0a6dcdccd63257942 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 29 Apr 1998 21:07:06 +0000 Subject: When following symlinks to the real executable, use a loop so a symlink to a symlink can work. (Jack) --- Modules/getpath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 */ -- cgit v0.12