summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-05-16 16:30:07 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-05-16 16:30:07 (GMT)
commita5297cf7c36358be626614b3363cc68a4d05c4ac (patch)
treecb28bf06f37536701afcf63abbcc8050fcf00778 /win
parent8f8a3bc1c00622bd15dd1a9d1dd06a906ed64f4e (diff)
downloadtcl-a5297cf7c36358be626614b3363cc68a4d05c4ac.zip
tcl-a5297cf7c36358be626614b3363cc68a4d05c4ac.tar.gz
tcl-a5297cf7c36358be626614b3363cc68a4d05c4ac.tar.bz2
Some more nmakehlp.c tweaks
Diffstat (limited to 'win')
-rw-r--r--win/nmakehlp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 4d95662..c8b39a7 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -727,11 +727,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
int keylen, ret;
WIN32_FIND_DATA finfo;
- if (dir == NULL || keypath == NULL)
+ if (dir == NULL || keypath == NULL) {
return 2; /* Have no real error reporting mechanism into nmake */
+ }
dirlen = strlen(dir);
- if ((dirlen + 3) > sizeof(path))
+ if (dirlen > sizeof(path) - 3) {
return 2;
+ }
strncpy(path, dir, dirlen);
strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */
keylen = strlen(keypath);
@@ -797,8 +799,9 @@ static int LocateDependency(const char *keypath)
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
ret = LocateDependencyHelper(paths[i], keypath);
- if (ret == 0)
+ if (ret == 0) {
return ret;
+ }
}
return ret;
}