Nullability check for shm module.
Bugs: b/245972273 Test: adb shell Change-Id: I9bdd5727719311d063fa126fc286618e9d24a45b
This commit is contained in:
parent
3285ae5a4d
commit
969d6c129a
2 changed files with 6 additions and 3 deletions
|
@ -47,11 +47,11 @@ __BEGIN_DECLS
|
|||
typedef unsigned long shmatt_t;
|
||||
|
||||
/** Not useful on Android; disallowed by SELinux. */
|
||||
void* shmat(int __shm_id, const void* __addr, int __flags) __INTRODUCED_IN(26);
|
||||
void* _Nonnull shmat(int __shm_id, const void* _Nullable __addr, int __flags) __INTRODUCED_IN(26);
|
||||
/** Not useful on Android; disallowed by SELinux. */
|
||||
int shmctl(int __shm_id, int __cmd, struct shmid_ds* __buf) __INTRODUCED_IN(26);
|
||||
int shmctl(int __shm_id, int __cmd, struct shmid_ds* _Nullable __buf) __INTRODUCED_IN(26);
|
||||
/** Not useful on Android; disallowed by SELinux. */
|
||||
int shmdt(const void* __addr) __INTRODUCED_IN(26);
|
||||
int shmdt(const void* _Nonnull __addr) __INTRODUCED_IN(26);
|
||||
/** Not useful on Android; disallowed by SELinux. */
|
||||
int shmget(key_t __key, size_t __size, int __flags) __INTRODUCED_IN(26);
|
||||
|
||||
|
|
|
@ -73,9 +73,12 @@ TEST(sys_shm, shmctl_failure) {
|
|||
}
|
||||
|
||||
TEST(sys_shm, shmdt_failure) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wnonnull"
|
||||
errno = 0;
|
||||
ASSERT_EQ(-1, shmdt(nullptr));
|
||||
ASSERT_TRUE(errno == EINVAL || errno == ENOSYS);
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
TEST(sys_shm, shmget_failure) {
|
||||
|
|
Loading…
Reference in a new issue