libc: enable sprintf FORTIFY_SOURCE under clang
clang doesn't support __builtin_va_arg_pack(), so we have to use #define instead. Change-Id: I2ee75e6267d60cdf997fee6b9b0547bf68f062a1
This commit is contained in:
@@ -450,10 +450,11 @@ int vfdprintf(int, const char*, __va_list)
|
||||
__END_DECLS
|
||||
#endif /* _GNU_SOURCE */
|
||||
|
||||
#if defined(__BIONIC_FORTIFY) && !defined(__clang__)
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if !defined(__clang__)
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
__printflike(3, 0)
|
||||
int vsnprintf(char *dest, size_t size, const char *format, __va_list ap)
|
||||
@@ -475,7 +476,11 @@ int snprintf(char *str, size_t size, const char *format, ...)
|
||||
return __builtin___snprintf_chk(str, size, 0,
|
||||
__bos(str), format, __builtin_va_arg_pack());
|
||||
}
|
||||
#endif /* !defined(__clang__) */
|
||||
|
||||
#if defined(__clang__)
|
||||
#define sprintf(dest, ...) __builtin___sprintf_chk(dest, 0, __bos(dest), __VA_ARGS__)
|
||||
#else
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
__printflike(2, 3)
|
||||
int sprintf(char *dest, const char *format, ...)
|
||||
@@ -483,7 +488,9 @@ int sprintf(char *dest, const char *format, ...)
|
||||
return __builtin___sprintf_chk(dest, 0,
|
||||
__bos(dest), format, __builtin_va_arg_pack());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(__clang__)
|
||||
extern char *__fgets_real(char *, int, FILE *)
|
||||
__asm__(__USER_LABEL_PREFIX__ "fgets");
|
||||
__errordecl(__fgets_too_big_error, "fgets called with size bigger than buffer");
|
||||
@@ -521,8 +528,10 @@ char *fgets(char *dest, int size, FILE *stream)
|
||||
return __fgets_chk(dest, size, stream, bos);
|
||||
}
|
||||
|
||||
#endif /* !defined(__clang__) */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* defined(__BIONIC_FORTIFY) && !defined(__clang__) */
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
#endif /* _STDIO_H_ */
|
||||
|
Reference in New Issue
Block a user