[Python-checkins] r42522 - python/trunk/Modules/getpath.c

georg.brandl python-checkins at python.org
Mon Feb 20 18:37:36 CET 2006


Author: georg.brandl
Date: Mon Feb 20 18:37:36 2006
New Revision: 42522

Modified:
   python/trunk/Modules/getpath.c
Log:
Patch #931938: prevent setting sys.prefix to ""


Modified: python/trunk/Modules/getpath.c
==============================================================================
--- python/trunk/Modules/getpath.c	(original)
+++ python/trunk/Modules/getpath.c	Mon Feb 20 18:37:36 2006
@@ -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);


More information about the Python-checkins mailing list