From e393bf6fe30acff8168d78a09661453046aadec1 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 20 Feb 2006 17:37:36 +0000 Subject: [PATCH] Patch #931938: prevent setting sys.prefix to "" --- Modules/getpath.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/getpath.c b/Modules/getpath.c index 3264e246a4..4716d15458 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); -- 2.40.0