summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/string/strdup.c')
-rw-r--r--lib/libc/string/strdup.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/libc/string/strdup.c b/lib/libc/string/strdup.c
index 6fa50ce..a1c2eed 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 <sys/types.h>
-
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@@ -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);
}
OpenPOWER on IntegriCloud