Dear list members, I am in need to write a simple program to return the passwd entry for a given uid number.
Here you have it: #include <sys/types.h> #include <errno.h> #include <pwd.h> #include <stdio.h> int main(int argc, char **argv) { struct passwd *p; int e; e = errno, errno = 0; p = getpwuid(0); if (errno) { fprintf(stdout, "errno is: %u\n", errno); return 127; } errno = e; fprintf(stdout, "%s\n", p->pw_name); return 0; } When i execute it i get this on a openbsd: sioux@lion$ ./pw errno is: 13 sioux@lion$ Any ideia why openbsd implementation of getpwuid returns error ? Thanks in advance.