diff --git a/libc/bionic/stubs.cpp b/libc/bionic/stubs.cpp index 1cab7d32f1d..48281b413fa 100644 --- a/libc/bionic/stubs.cpp +++ b/libc/bionic/stubs.cpp @@ -371,7 +371,8 @@ passwd* getpwnam(const char* login) { // NOLINT: implementing bad function. return app_id_to_passwd(app_id_from_name(login), state); } -int getgrouplist(const char* user, gid_t group, gid_t* groups, int* ngroups) { +// All users are in just one group, the one passed in. +int getgrouplist(const char* /*user*/, gid_t group, gid_t* groups, int* ngroups) { if (*ngroups < 1) { *ngroups = 1; return -1; @@ -412,51 +413,51 @@ group* getgrnam(const char* name) { // NOLINT: implementing bad function. return app_id_to_group(app_id_from_name(name), state); } -static void unimplemented_stub(const char* function) { - const char* fmt = "%s(3) is not implemented on Android\n"; - __libc_android_log_print(ANDROID_LOG_WARN, "libc", fmt, function); - fprintf(stderr, fmt, function); +// We don't have an /etc/networks, so all inputs return NULL. +netent* getnetbyname(const char* /*name*/) { + return NULL; } -#define UNIMPLEMENTED unimplemented_stub(__PRETTY_FUNCTION__) - -netent* getnetbyname(const char* name) { - UNIMPLEMENTED; +// We don't have an /etc/networks, so all inputs return NULL. +netent* getnetbyaddr(uint32_t /*net*/, int /*type*/) { return NULL; } -void endpwent() { - UNIMPLEMENTED; +// We don't have an /etc/protocols, so all inputs return NULL. +protoent* getprotobyname(const char* /*name*/) { + return NULL; } -mntent* getmntent(FILE* f) { - UNIMPLEMENTED; +// We don't have an /etc/protocols, so all inputs return NULL. +protoent* getprotobynumber(int /*proto*/) { return NULL; } -char* ttyname(int fd) { // NOLINT: implementing bad function. - UNIMPLEMENTED; - return NULL; +static void unimplemented_stub(const char* function) { + const char* fmt = "%s(3) is not implemented on Android\n"; + __libc_android_log_print(ANDROID_LOG_WARN, "libc", fmt, function); + fprintf(stderr, fmt, function); } -int ttyname_r(int fd, char* buf, size_t buflen) { +#define UNIMPLEMENTED unimplemented_stub(__PRETTY_FUNCTION__) + +void endpwent() { UNIMPLEMENTED; - return -ERANGE; } -netent* getnetbyaddr(uint32_t net, int type) { +mntent* getmntent(FILE* /*f*/) { UNIMPLEMENTED; return NULL; } -protoent* getprotobyname(const char* name) { +char* ttyname(int /*fd*/) { // NOLINT: implementing bad function. UNIMPLEMENTED; return NULL; } -protoent* getprotobynumber(int proto) { +int ttyname_r(int /*fd*/, char* /*buf*/, size_t /*buflen*/) { UNIMPLEMENTED; - return NULL; + return -ERANGE; } char* getusershell() {