diff options
Diffstat (limited to 'userland/libc/string/strlcpy.c')
-rw-r--r-- | userland/libc/string/strlcpy.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/userland/libc/string/strlcpy.c b/userland/libc/string/strlcpy.c index a2d3dd9..041522b 100644 --- a/userland/libc/string/strlcpy.c +++ b/userland/libc/string/strlcpy.c @@ -7,12 +7,14 @@ size_t *strlcpy(char *s1, const char *s2, size_t n) { size_t tmp_n = n; const char *os2 = s2; for (; tmp_n; tmp_n--) { - if ((*s1++ = *s2++) == '\0') + if ((*s1++ = *s2++) == '\0') { break; + } } if (tmp_n == 0) { - if (n != 0) + if (n != 0) { *s1 = '\0'; /* NUL-terminate s1 */ + } while (*s2++) ; } |