summaryrefslogtreecommitdiffstats
path: root/Modules/getpath.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-02-20 17:37:36 (GMT)
committerGeorg Brandl <georg@python.org>2006-02-20 17:37:36 (GMT)
commite393bf6fe30acff8168d78a09661453046aadec1 (patch)
tree7c13c1212736d9dc1b2ad445bdd031f5c5f17e37 /Modules/getpath.c
parent69774c212a35c5b271729a47dc9ae2fc6d7cef29 (diff)
downloadcpython-e393bf6fe30acff8168d78a09661453046aadec1.zip
cpython-e393bf6fe30acff8168d78a09661453046aadec1.tar.gz
cpython-e393bf6fe30acff8168d78a09661453046aadec1.tar.bz2
Patch #931938: prevent setting sys.prefix to ""
Diffstat (limited to 'Modules/getpath.c')
-rw-r--r--Modules/getpath.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 3264e24..4716d15 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);