Whamcloud - gitweb
LU-1855 build: fix 'out-of-bounds access' errors
[fs/lustre-release.git] / libcfs / libcfs / user-prim.c
index 0d8afc6..0cc1e3d 100644 (file)
@@ -276,6 +276,20 @@ size_t strlcpy(char *tgt, const char *src, size_t tgt_len)
 }
 #endif
 
+#ifndef HAVE_STRLCAT /* not in glibc for RHEL 5.x, remove when obsolete */
+size_t strlcat(char *tgt, const char *src, size_t size)
+{
+       size_t tgt_len = strlen(tgt);
+
+       if (size > tgt_len) {
+               strncat(tgt, src, size - tgt_len - 1);
+               tgt[size - 1] = '\0';
+       }
+
+       return tgt_len + strlen(src);
+}
+#endif
+
 /* Read the environment variable of current process specified by @key. */
 int cfs_get_environ(const char *key, char *value, int *val_len)
 {