Fix builds where _FORTIFY_SOURCE is off.
Also add a more intention-revealing guard so we don't have loads of places checking whether our inlining macro is defined. Change-Id: I168860cedcfc798b07a5145bc48a125700265e47
This commit is contained in:
parent
34895c1bdf
commit
890c8ed6ef
6 changed files with 12 additions and 11 deletions
|
@ -49,7 +49,7 @@ extern int unlinkat(int dirfd, const char *pathname, int flags);
|
|||
extern int fcntl(int fd, int command, ...);
|
||||
extern int creat(const char* path, mode_t mode);
|
||||
|
||||
#if defined(__BIONIC_FORTIFY_INLINE)
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
extern void __creat_error()
|
||||
__attribute__((__error__ ("called with O_CREAT, but missing mode")));
|
||||
|
@ -101,7 +101,7 @@ int openat(int dirfd, const char *pathname, int flags, ...) {
|
|||
return __openat_real(dirfd, pathname, flags, __builtin_va_arg_pack());
|
||||
}
|
||||
|
||||
#endif /* defined(__BIONIC_FORTIFY_INLINE) */
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ int vfdprintf(int, const char*, __va_list)
|
|||
__END_DECLS
|
||||
#endif /* _GNU_SOURCE */
|
||||
|
||||
#if defined(__BIONIC_FORTIFY_INLINE)
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -538,6 +538,6 @@ char *fgets(char *dest, int size, FILE *stream)
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* defined(__BIONIC_FORTIFY_INLINE) */
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
#endif /* _STDIO_H_ */
|
||||
|
|
|
@ -84,7 +84,7 @@ extern char* strsignal(int sig);
|
|||
extern int strcoll(const char *, const char *) __purefunc;
|
||||
extern size_t strxfrm(char *, const char *, size_t);
|
||||
|
||||
#if defined(__BIONIC_FORTIFY_INLINE)
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
extern void __memcpy_dest_size_error()
|
||||
__attribute__((__error__("memcpy called with size bigger than destination")));
|
||||
|
@ -258,7 +258,7 @@ char* strrchr(const char *s, int c) {
|
|||
}
|
||||
|
||||
|
||||
#endif /* defined(__BIONIC_FORTIFY_INLINE) */
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ char *index(const char *, int);
|
|||
int strcasecmp(const char *, const char *);
|
||||
int strncasecmp(const char *, const char *, size_t);
|
||||
|
||||
#if defined(__BIONIC_FORTIFY_INLINE)
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
void bzero (void *s, size_t n) {
|
||||
__builtin___memset_chk(s, '\0', n, __builtin_object_size (s, 0));
|
||||
}
|
||||
#endif /* defined(__BIONIC_FORTIFY_INLINE) */
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -516,13 +516,14 @@
|
|||
#include <android/api-level.h>
|
||||
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 && !defined(__clang__)
|
||||
#define __BIONIC_FORTIFY 1
|
||||
#define __BIONIC_FORTIFY_INLINE \
|
||||
extern inline \
|
||||
__attribute__ ((always_inline)) \
|
||||
__attribute__ ((gnu_inline)) \
|
||||
__attribute__ ((artificial))
|
||||
#define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
|
||||
#endif
|
||||
#define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
|
||||
|
||||
/* Android-added: for FreeBSD's libm. */
|
||||
#define __weak_reference(sym,alias) \
|
||||
|
|
|
@ -129,7 +129,7 @@ extern int lstat(const char *, struct stat *);
|
|||
extern int mknod(const char *, mode_t, dev_t);
|
||||
extern mode_t umask(mode_t);
|
||||
|
||||
#if defined(__BIONIC_FORTIFY_INLINE)
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
extern mode_t __umask_chk(mode_t);
|
||||
extern mode_t __umask_real(mode_t)
|
||||
|
@ -147,7 +147,7 @@ mode_t umask(mode_t mode) {
|
|||
}
|
||||
return __umask_chk(mode);
|
||||
}
|
||||
#endif /* defined(__BIONIC_FORTIFY_INLINE) */
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
|
||||
#define stat64 stat
|
||||
|
|
Loading…
Reference in a new issue