mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Patch #931938: prevent setting sys.prefix to ""
This commit is contained in:
parent
69774c212a
commit
e393bf6fe3
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue