/*[XSI]*/ /* Test whether a basic getpwent invocation works. */ #include #include #include #include #include "../basic.h" int main(void) { uid_t uid = getuid(); struct passwd* pwd; bool found = false; // getpwent is supposed to setpwent if needed. while ( (errno = 0, pwd = getpwent()) ) { if ( pwd->pw_uid == uid ) found = true; } if ( errno ) err(1, "getpwent"); if ( !found ) errx(1, "did not find user"); return 0; }