diff options
author | Georg Brandl <georg@python.org> | 2006-02-20 17:37:39 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-02-20 17:37:39 (GMT) |
commit | e5db6b21346a12da391847785a04ab522431f91e (patch) | |
tree | e290d3261cd14a8e4faf55e8e958220f4e287011 | |
parent | f1a408d40e34186297d490515498315d3f29c278 (diff) | |
download | cpython-e5db6b21346a12da391847785a04ab522431f91e.zip cpython-e5db6b21346a12da391847785a04ab522431f91e.tar.gz cpython-e5db6b21346a12da391847785a04ab522431f91e.tar.bz2 |
Patch #931938: prevent setting sys.prefix to ""
-rw-r--r-- | Modules/getpath.c | 6 |
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); |