Merge "libc fortify: make fcntl.h use diagnose_if" am: 5ac5a7c083
am: 96eb6cbf9a
Change-Id: I383158d43d7cc65ef6d48c3aa8d5c9a7a264d639
This commit is contained in:
commit
f7c19622a3
2 changed files with 8 additions and 16 deletions
|
@ -48,11 +48,6 @@ __BIONIC_ERROR_FUNCTION_VISIBILITY
|
||||||
int open(const char* pathname, int flags, mode_t modes, ...) __overloadable
|
int open(const char* pathname, int flags, mode_t modes, ...) __overloadable
|
||||||
__errorattr(__open_too_many_args_error);
|
__errorattr(__open_too_many_args_error);
|
||||||
|
|
||||||
__BIONIC_ERROR_FUNCTION_VISIBILITY
|
|
||||||
int open(const char* pathname, int flags) __overloadable
|
|
||||||
__enable_if(flags & O_CREAT, __open_too_few_args_error)
|
|
||||||
__errorattr(__open_too_few_args_error);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pass_object_size serves two purposes here, neither of which involve __bos: it
|
* pass_object_size serves two purposes here, neither of which involve __bos: it
|
||||||
* disqualifies this function from having its address taken (so &open works),
|
* disqualifies this function from having its address taken (so &open works),
|
||||||
|
@ -60,22 +55,17 @@ int open(const char* pathname, int flags) __overloadable
|
||||||
* open(const char *, int, ...).
|
* open(const char *, int, ...).
|
||||||
*/
|
*/
|
||||||
__BIONIC_FORTIFY_INLINE
|
__BIONIC_FORTIFY_INLINE
|
||||||
int open(const char* const __pass_object_size pathname,
|
int open(const char* const __pass_object_size pathname, int flags)
|
||||||
int flags) __overloadable {
|
__overloadable
|
||||||
|
__clang_error_if(flags & O_CREAT, "'open' " __open_too_few_args_error) {
|
||||||
return __open_2(pathname, flags);
|
return __open_2(pathname, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
__BIONIC_FORTIFY_INLINE
|
__BIONIC_FORTIFY_INLINE
|
||||||
int open(const char* const __pass_object_size pathname, int flags, mode_t modes)
|
int open(const char* const __pass_object_size pathname, int flags, mode_t modes) __overloadable {
|
||||||
__overloadable {
|
|
||||||
return __open_real(pathname, flags, modes);
|
return __open_real(pathname, flags, modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
__BIONIC_ERROR_FUNCTION_VISIBILITY
|
|
||||||
int openat(int dirfd, const char* pathname, int flags) __overloadable
|
|
||||||
__enable_if(flags & O_CREAT, __open_too_few_args_error)
|
|
||||||
__errorattr(__open_too_few_args_error);
|
|
||||||
|
|
||||||
__BIONIC_ERROR_FUNCTION_VISIBILITY
|
__BIONIC_ERROR_FUNCTION_VISIBILITY
|
||||||
int openat(int dirfd, const char* pathname, int flags, mode_t modes, ...)
|
int openat(int dirfd, const char* pathname, int flags, mode_t modes, ...)
|
||||||
__overloadable
|
__overloadable
|
||||||
|
@ -83,7 +73,9 @@ int openat(int dirfd, const char* pathname, int flags, mode_t modes, ...)
|
||||||
|
|
||||||
__BIONIC_FORTIFY_INLINE
|
__BIONIC_FORTIFY_INLINE
|
||||||
int openat(int dirfd, const char* const __pass_object_size pathname,
|
int openat(int dirfd, const char* const __pass_object_size pathname,
|
||||||
int flags) __overloadable {
|
int flags)
|
||||||
|
__overloadable
|
||||||
|
__clang_error_if(flags & O_CREAT, "'openat' " __open_too_few_args_error) {
|
||||||
return __openat_2(dirfd, pathname, flags);
|
return __openat_2(dirfd, pathname, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ void test_read() {
|
||||||
void test_open() {
|
void test_open() {
|
||||||
// NOLINTNEXTLINE(whitespace/line_length)
|
// NOLINTNEXTLINE(whitespace/line_length)
|
||||||
// GCC: error: call to '__creat_missing_mode' declared with attribute error: called with O_CREAT, but missing mode
|
// GCC: error: call to '__creat_missing_mode' declared with attribute error: called with O_CREAT, but missing mode
|
||||||
// CLANG: error: call to unavailable function 'open': called with O_CREAT, but missing mode
|
// CLANG: error: 'open' called with O_CREAT, but missing mode
|
||||||
open("/dev/null", O_CREAT);
|
open("/dev/null", O_CREAT);
|
||||||
|
|
||||||
// NOLINTNEXTLINE(whitespace/line_length)
|
// NOLINTNEXTLINE(whitespace/line_length)
|
||||||
|
|
Loading…
Reference in a new issue