From: Georg Brandl Date: Mon, 20 Feb 2006 17:37:39 +0000 (+0000) Subject: Patch #931938: prevent setting sys.prefix to "" X-Git-Tag: v2.4.3c1~62 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5db6b21346a12da391847785a04ab522431f91e;p=thirdparty%2FPython%2Fcpython.git Patch #931938: prevent setting sys.prefix to "" --- diff --git a/Modules/getpath.c b/Modules/getpath.c index 3264e246a41a..4716d154587e 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -628,6 +628,10 @@ calculate_path(void) if (pfound > 0) { reduce(prefix); reduce(prefix); + /* The prefix is the root directory, but reduce() chopped + * off the "/". */ + if (!prefix[0]) + strcpy(prefix, separator); } else strncpy(prefix, PREFIX, MAXPATHLEN); @@ -636,6 +640,8 @@ calculate_path(void) reduce(exec_prefix); reduce(exec_prefix); reduce(exec_prefix); + if (!exec_prefix[0]) + strcpy(exec_prefix, separator); } else strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);