1 // commit 0afef1aa24b784c86ae6121ca39e999824086c7c
2 // preexisting errno should not be interpreted by passwd/group functions
3 
4 #include <pwd.h>
5 #include <errno.h>
6 #include "test.h"
7 
main(void)8 int main(void)
9 {
10 	int baderr = EOWNERDEAD; // arbitrary absurd error
11 	struct passwd *pw, pwbuf;
12 	char buf[1024];
13 	errno = baderr;
14 	if (getpwnam_r("nonsensical_user", &pwbuf, buf, sizeof buf, &pw) == baderr)
15 		t_error("getpwnam_r used preexisting errno for nonexisting user\n");
16 	return t_status;
17 }
18