chiark / gitweb /
klibc: version 1.0.14
[elogind.git] / klibc / klibc / strlcat.c
index 6111445f0629948c738ecd91b2cd2fe54a86c5db..f397857e76362f3badc9763f14aa06ba3779a677 100644 (file)
@@ -16,9 +16,11 @@ size_t strlcat(char *dst, const char *src, size_t size)
     q++;
     bytes++;
   }
+  if (bytes == size)
+    return (bytes + strlen(src));
 
   while ( (ch = *p++) ) {
-    if ( bytes < size )
+    if ( bytes+1 < size )
       *q++ = ch;
 
     bytes++;