Patch #931938: prevent setting sys.prefix to ""
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 @@
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 @@
reduce(exec_prefix);
reduce(exec_prefix);
reduce(exec_prefix);
+ if (!exec_prefix[0])
+ strcpy(exec_prefix, separator);
}
else
strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);