mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-29 20:54:13 +01:00
Don't include <sys/types.h> to get u_int or use u_int for a bogus cast.
Modernize bcopy -> memcpy.
This commit is contained in:
parent
ed0e48f6c0
commit
2933861562
@ -35,8 +35,6 @@
|
|||||||
static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -49,8 +47,8 @@ strdup(str)
|
|||||||
char *copy;
|
char *copy;
|
||||||
|
|
||||||
len = strlen(str) + 1;
|
len = strlen(str) + 1;
|
||||||
if (!(copy = malloc((u_int)len)))
|
if ((copy = malloc(len)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
bcopy(str, copy, len);
|
memcpy(copy, str, len);
|
||||||
return (copy);
|
return (copy);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user