summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/replace.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c
index b8f4bc1c3c..4048fe558e 100644
--- a/source4/lib/replace/replace.c
+++ b/source4/lib/replace/replace.c
@@ -367,7 +367,23 @@ duplicate a string
#endif /* HAVE_SYSLOG */
#endif /* HAVE_VSYSLOG */
-
+#ifndef HAVE_STRNLEN
+/**
+ Some platforms don't have strnlen
+**/
+ size_t strnlen(const char *s, size_t max)
+{
+ size_t len;
+
+ for (len = 0; len < max; len++) {
+ if (s[len] == '\0') {
+ break;
+ }
+ }
+ return len;
+}
+#endif
+
#ifndef HAVE_STRNDUP
/**
Some platforms don't have strndup.