diff --git a/lib/libc/string/strdup.c b/lib/libc/string/strdup.c index 6fa50ceecff9..a1c2eedaf891 100644 --- a/lib/libc/string/strdup.c +++ b/lib/libc/string/strdup.c @@ -35,8 +35,6 @@ static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -#include - #include #include #include @@ -49,8 +47,8 @@ strdup(str) char *copy; len = strlen(str) + 1; - if (!(copy = malloc((u_int)len))) + if ((copy = malloc(len)) == NULL) return (NULL); - bcopy(str, copy, len); + memcpy(copy, str, len); return (copy); }