summaryrefslogtreecommitdiff
path: root/lib/libc/string/strdup.c
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1994-09-05 13:41:33 +0000
committerBruce Evans <bde@FreeBSD.org>1994-09-05 13:41:33 +0000
commitaeeb6869a570f2e3b747bd302c90210078d65780 (patch)
tree2c66fae4984761c9c9ad914e37ea96e59920d79a /lib/libc/string/strdup.c
parent5ec11cf0bb5c7df74b072ed321243ec613015eb5 (diff)
Notes
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 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 <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);
}