Kaydet (Commit) e393bf6f authored tarafından Georg Brandl's avatar Georg Brandl

Patch #931938: prevent setting sys.prefix to ""

üst 69774c21
...@@ -628,6 +628,10 @@ calculate_path(void) ...@@ -628,6 +628,10 @@ calculate_path(void)
if (pfound > 0) { if (pfound > 0) {
reduce(prefix); reduce(prefix);
reduce(prefix); reduce(prefix);
/* The prefix is the root directory, but reduce() chopped
* off the "/". */
if (!prefix[0])
strcpy(prefix, separator);
} }
else else
strncpy(prefix, PREFIX, MAXPATHLEN); strncpy(prefix, PREFIX, MAXPATHLEN);
...@@ -636,6 +640,8 @@ calculate_path(void) ...@@ -636,6 +640,8 @@ calculate_path(void)
reduce(exec_prefix); reduce(exec_prefix);
reduce(exec_prefix); reduce(exec_prefix);
reduce(exec_prefix); reduce(exec_prefix);
if (!exec_prefix[0])
strcpy(exec_prefix, separator);
} }
else else
strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN); strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment