4
#define FIX(x) (pw->pw_##x = pw->pw_##x-line+buf)
6
static int getpw_r(const char *name, uid_t uid, struct passwd *pw, char *buf, size_t size, struct passwd **res)
14
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
16
f = fopen("/etc/passwd", "rbe");
23
while (__getpwent_a(f, pw, &line, &len)) {
24
if (name && !strcmp(name, pw->pw_name)
25
|| !name && pw->pw_uid == uid) {
31
memcpy(buf, line, len);
43
pthread_setcancelstate(cs, 0);
47
int getpwnam_r(const char *name, struct passwd *pw, char *buf, size_t size, struct passwd **res)
49
return getpw_r(name, 0, pw, buf, size, res);
52
int getpwuid_r(uid_t uid, struct passwd *pw, char *buf, size_t size, struct passwd **res)
54
return getpw_r(0, uid, pw, buf, size, res);