aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2024-07-04 15:06:59 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2024-07-04 15:06:59 -0400
commitae76ca481b4000bdd474597665a2af1ecf3ec6d7 (patch)
treefc144db2717f96b033ef701b3f29c83583581e02
parentfix include (diff)
downloadcli-ae76ca481b4000bdd474597665a2af1ecf3ec6d7.zip
tweak strlcat
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/strlcat.h6
2 files changed, 4 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa4eb23..67ab38d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@ endif()
include(CheckFunctionExists)
check_function_exists(strlcat HAVE_STRLCAT)
-if(NOT HAVE_STRLCAT)
+if(HAVE_STRLCAT)
add_definitions(-DHAVE_STRLCAT=1)
endif()
diff --git a/src/strlcat.h b/src/strlcat.h
index 1af6bb1..6317855 100644
--- a/src/strlcat.h
+++ b/src/strlcat.h
@@ -11,17 +11,17 @@
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
* If retval >= siz, truncation occurred.
*/
-size_t strlcat(char *dst, const char *src, size_t siz) {
+size_t strlcat(char *dst, const char *src, size_t dstsize) {
char *d = dst;
const char *s = src;
- size_t n = siz;
+ size_t n = dstsize;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
- n = siz - dlen;
+ n = dstsize - dlen;
if (n == 0) return (dlen + strlen(s));
while (*s != '\0') {