strange error on openbsd: program listing

2013-05-07 Thread Friedrich Locke
Here you have it: #include #include #include #include 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);

Re: strange error on openbsd

2013-05-07 Thread MJ
Why reinvent the wheel? [root@black ~]# getent passwd 1 daemon:*:1:1:The devil himself:/root:/sbin/nologin [root@black ~]# -mike On May 7, 2013, at 4:06 AM, Friedrich Locke wrote: > Dear list members, > > I am in need to write a simple program to return the passwd entry for a > given uid nu

Re: strange error on openbsd

2013-05-07 Thread Remco
On Tuesday 07 May 2013 15:45:55 you wrote: > On Tue, May 07, 2013 at 03:25:04PM +0200, Remco wrote: > | The way I read the man page on my OpenBSD 5.2 system, as well as on the > | www.openbsd.org web site, errno has no specific meaning when getpwuid > | returns. It only tells you whether it succeed

Re: strange error on openbsd

2013-05-07 Thread Paul de Weerd
On Tue, May 07, 2013 at 03:25:04PM +0200, Remco wrote: | The way I read the man page on my OpenBSD 5.2 system, as well as on the | www.openbsd.org web site, errno has no specific meaning when getpwuid | returns. It only tells you whether it succeeded or not, it doesn't say it | sets errno, nor d

Re: strange error on openbsd

2013-05-07 Thread Remco
Philip Guenther wrote: > On Mon, May 6, 2013 at 6:06 PM, Friedrich Locke > wrote: >> I am in need to write a simple program to return the passwd entry for a >> given uid number. >> >> Here you have it: >> >> #include >> #include >> #include >> #include >> >> int >> main(int argc, char **argv)

Re: strange error on openbsd

2013-05-07 Thread Janne Johansson
mtree wants them to be: # grep ^pwd.db /etc/mtree/* /etc/mtree/special:pwd.db type=file mode=0444 uname=root gname=wheel optional 2013/5/7 noah pugsley > On Mon, May 6, 2013 at 6:31 PM, Ted Unangst wrote: > > > On Mon, May 06, 2013 at 22:06, Friedrich Locke wrote: > > > > > e =

Re: Strange error on OPenBSD

2013-05-06 Thread patrick keshishian
On Mon, May 6, 2013 at 7:51 PM, Friedrich Locke wrote: > As Noah Pugsley noted: it should have worked, regardless error checking > code is not right. > > As asked: > > sioux@scallop$ ls -l /etc/pwd.db /etc/spwd.db > -rw-r--r-- 1 root wheel1220608 May 1 12:41 /etc/pwd.db > -rw-r- 1 root

Re: Strange error on OPenBSD

2013-05-06 Thread Philip Guenther
On Mon, May 6, 2013 at 7:51 PM, Friedrich Locke wrote: > As Noah Pugsley noted: it should have worked, regardless error checking > code is not right. > > As asked: > > sioux@scallop$ ls -l /etc/pwd.db /etc/spwd.db > -rw-r--r-- 1 root wheel1220608 May 1 12:41 /etc/pwd.db > -rw-r- 1 root

Strange error on OPenBSD

2013-05-06 Thread Friedrich Locke
As Noah Pugsley noted: it should have worked, regardless error checking code is not right. As asked: sioux@scallop$ ls -l /etc/pwd.db /etc/spwd.db -rw-r--r-- 1 root wheel1220608 May 1 12:41 /etc/pwd.db -rw-r- 1 root _shadow 1273856 May 1 12:41 /etc/spwd.db sioux@scallop$ I am run

Re: strange error on openbsd

2013-05-06 Thread noah pugsley
On Mon, May 6, 2013 at 6:31 PM, Ted Unangst wrote: > On Mon, May 06, 2013 at 22:06, Friedrich Locke wrote: > > > e = errno, errno = 0; > > p = getpwuid(0); > > if (errno) { > > fprintf(stdout, "errno is: %u\n", errno); > > > > sioux@lion$ ./pw > > errno is: 13 > > sioux@lion$ > > > > > > Any idei

Re: strange error on openbsd

2013-05-06 Thread Ted Unangst
On Mon, May 06, 2013 at 22:06, Friedrich Locke wrote: > e = errno, errno = 0; > p = getpwuid(0); > if (errno) { > fprintf(stdout, "errno is: %u\n", errno); > > sioux@lion$ ./pw > errno is: 13 > sioux@lion$ > > > Any ideia why openbsd implementation of getpwuid returns error ? That is not how th

Re: strange error on openbsd

2013-05-06 Thread Philip Guenther
On Mon, May 6, 2013 at 6:06 PM, Friedrich Locke wrote: > I am in need to write a simple program to return the passwd entry for a > given uid number. > > Here you have it: > > #include > #include > #include > #include > > int > main(int argc, char **argv) > { > struct passwd *p; >

strange error on openbsd

2013-05-06 Thread Friedrich Locke
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 #include #include #include int main(int argc, char **argv) { struct passwd *p; int e; e = errno, errno = 0;