summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2007-04-25 00:10:50 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2007-04-25 00:10:50 (GMT)
commit17b8e97e2e2c24322d45c33308212e0d6c32d934 (patch)
treeb29361f28ad72a27c5d235e75a6340ebf03209d4 /Modules/posixmodule.c
parente133a95d1c6c6b28afe66dc0118282fe0d1073f1 (diff)
downloadcpython-17b8e97e2e2c24322d45c33308212e0d6c32d934.zip
cpython-17b8e97e2e2c24322d45c33308212e0d6c32d934.tar.gz
cpython-17b8e97e2e2c24322d45c33308212e0d6c32d934.tar.bz2
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 8fc9fa9..bb1dc4f 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4841,18 +4841,19 @@ _PyPopenCreateProcess(char *cmdstring,
(sizeof(modulepath)/sizeof(modulepath[0]))
-strlen(modulepath));
if (stat(modulepath, &statinfo) != 0) {
+ size_t mplen = sizeof(modulepath)/sizeof(modulepath[0]);
/* Eeek - file-not-found - possibly an embedding
situation - see if we can locate it in sys.prefix
*/
strncpy(modulepath,
Py_GetExecPrefix(),
- sizeof(modulepath)/sizeof(modulepath[0]));
+ mplen);
+ modulepath[mplen-1] = '\0';
if (modulepath[strlen(modulepath)-1] != '\\')
strcat(modulepath, "\\");
strncat(modulepath,
szConsoleSpawn,
- (sizeof(modulepath)/sizeof(modulepath[0]))
- -strlen(modulepath));
+ mplen-strlen(modulepath));
/* No where else to look - raise an easily identifiable
error, rather than leaving Windows to report
"file not found" - as the user is probably blissfully