Mercurial > cpython-lru_cache-weakref
diff Modules/getpath.c @ 36624:ff9afeb05b34 2.4
Patch #931938: prevent setting sys.prefix to ""
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Mon, 20 Feb 2006 17:37:39 +0000 |
| parents | 8791e8c448b3 |
| children |
line wrap: on
line diff
--- a/Modules/getpath.c Mon Feb 20 13:12:07 2006 +0000 +++ b/Modules/getpath.c Mon Feb 20 17:37:39 2006 +0000 @@ -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);
