Use __builtin_*_chk for bcopy/bzero.

Replacing memmove/memset with their builtin check equivalents fixes an
implicit definition warning when only including strings.h.

Change-Id: I74f03b9506ea37f5c2f9c11498e379a70998b430
This commit is contained in:
Dan Albert 2014-06-21 18:04:54 -07:00
parent 54e9dc0213
commit 8ca440089f
1 changed files with 10 additions and 2 deletions

View File

@ -43,8 +43,16 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__BEGIN_DECLS __BEGIN_DECLS
#define bcopy(b1, b2, len) (void)(memmove((b2), (b1), (len))) #if defined(__BIONIC_FORTIFY)
#define bzero(b, len) (void)(memset((b), '\0', (len))) #define bcopy(b1, b2, len) \
(void)(__builtin___memmove_chk((b2), (b1), (len), __bos0(b2)))
#define bzero(b, len) \
(void)(__builtin___memset_chk((b), '\0', (len), __bos0(b)))
#else
#define bcopy(b1, b2, len) (void)(__builtin_memmove((b2), (b1), (len)))
#define bzero(b, len) (void)(__builtin_memset((b), '\0', (len)))
#endif
int ffs(int); int ffs(int);
int strcasecmp(const char *, const char *); int strcasecmp(const char *, const char *);