Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Clean up warnings in stubs.cpp.
Browse files Browse the repository at this point in the history
Change-Id: Ie0792846de7cf5f5c72737494bf78ab8dcb8cc3e
  • Loading branch information
enh-google committed Oct 22, 2012
1 parent 4e45775 commit 6fa26e2
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions libc/bionic/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 6fa26e2

Please sign in to comment.