Nullability check for pwd module

Bugs: b/245972273
Test: adb shell
Change-Id: I855a4e6401220e2b84f303420e8fca63bcf47e03
This commit is contained in:
zijunzhao 2023-03-17 02:53:37 +00:00
parent 529c16a678
commit 5250d79abc

View file

@ -66,31 +66,31 @@
__BEGIN_DECLS __BEGIN_DECLS
struct passwd { struct passwd {
char* pw_name; char* _Nullable pw_name;
char* pw_passwd; char* _Nullable pw_passwd;
uid_t pw_uid; uid_t pw_uid;
gid_t pw_gid; gid_t pw_gid;
#ifdef __LP64__ #ifdef __LP64__
char* pw_gecos; char* _Nullable pw_gecos;
#else #else
/* Note: On LP32, we define pw_gecos to pw_passwd since they're both NULL. */ /* Note: On LP32, we define pw_gecos to pw_passwd since they're both NULL. */
# define pw_gecos pw_passwd # define pw_gecos pw_passwd
#endif #endif
char* pw_dir; char* _Nullable pw_dir;
char* pw_shell; char* _Nullable pw_shell;
}; };
struct passwd* getpwnam(const char* __name); struct passwd* _Nullable getpwnam(const char* _Nonnull __name);
struct passwd* getpwuid(uid_t __uid); struct passwd* _Nullable getpwuid(uid_t __uid);
/* Note: Android has thousands and thousands of ids to iterate through */ /* Note: Android has thousands and thousands of ids to iterate through */
struct passwd* getpwent(void) __INTRODUCED_IN(26); struct passwd* _Nullable getpwent(void) __INTRODUCED_IN(26);
void setpwent(void) __INTRODUCED_IN(26); void setpwent(void) __INTRODUCED_IN(26);
void endpwent(void) __INTRODUCED_IN(26); void endpwent(void) __INTRODUCED_IN(26);
int getpwnam_r(const char* __name, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result); int getpwnam_r(const char* _Nonnull __name, struct passwd* _Nonnull __pwd, char* _Nonnull __buf, size_t __n, struct passwd* _Nullable * _Nonnull __result);
int getpwuid_r(uid_t __uid, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result); int getpwuid_r(uid_t __uid, struct passwd* _Nonnull __pwd, char* _Nonnull __buf, size_t __n, struct passwd* _Nullable * _Nonnull __result);
__END_DECLS __END_DECLS