diff options
Diffstat (limited to 'string/strndup.c')
-rw-r--r-- | string/strndup.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/string/strndup.c b/string/strndup.c index 8757b869d5..72635bb97c 100644 --- a/string/strndup.c +++ b/string/strndup.c @@ -22,7 +22,7 @@ Cambridge, MA 02139, USA. */ char * -strndup (const char *s, size_t n) +__strndup (const char *s, size_t n) { size_t len = strnlen (s, n); char *new = malloc (len + 1); @@ -30,9 +30,7 @@ strndup (const char *s, size_t n) if (new == NULL) return NULL; - memcpy (new, s, len); new[len] = '\0'; - - return new; + return memcpy (new, s, len); } - +weak_alias (__strndup, strndup) |