summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libcruft/getpwnam_r.c
blob: 55f0bf634cc9106cba49820e683a1d0867af9faf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string.h>
#include <pwd.h>

int getpwnam_r(const char* name,
	       struct passwd *res, char *buf, size_t buflen,
	       struct passwd **res_sig) {
  while (!getpwent_r(res,buf,buflen,res_sig))
    if (!strcmp(name,res->pw_name))
      goto ok;
  *res_sig=0;
ok:
  endpwent();
  return *res_sig?0:-1;
}