diff options
Diffstat (limited to 'userland/libc/string/strndup.c')
-rw-r--r-- | userland/libc/string/strndup.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/userland/libc/string/strndup.c b/userland/libc/string/strndup.c index 22d6303..3240d97 100644 --- a/userland/libc/string/strndup.c +++ b/userland/libc/string/strndup.c @@ -1,7 +1,7 @@ +#include <math.h> #include <stddef.h> #include <stdlib.h> #include <string.h> -#include <math.h> // The strndup() function shall be equivalent to the strdup() function, // duplicating the provided s in a new block of memory allocated as if @@ -16,8 +16,9 @@ char *strndup(const char *s, size_t size) { size_t l = strlen(s); size_t real_l = min(l, size); char *r = malloc(real_l + 1); - if (!r) + if (!r) { return NULL; + } strlcpy(r, s, real_l); return r; } |