diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c index dc6bdb7633af..078c7c2fafe8 100644 --- a/lib/libutil/passwd.c +++ b/lib/libutil/passwd.c @@ -1,4 +1,4 @@ -/* $NetBSD: passwd.c,v 1.39 2005/01/15 03:07:56 christos Exp $ */ +/* $NetBSD: passwd.c,v 1.40 2005/08/18 21:07:23 elad Exp $ */ /* * Copyright (c) 1987, 1993, 1994, 1995 @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: passwd.c,v 1.39 2005/01/15 03:07:56 christos Exp $"); +__RCSID("$NetBSD: passwd.c,v 1.40 2005/08/18 21:07:23 elad Exp $"); #endif /* LIBC_SCCS and not lint */ #include @@ -577,6 +577,11 @@ pw_getconf(char *data, size_t max, const char *key, const char *option) } fclose(fp); + if (!found) + errno = ENOENT; + if (!got) + errno = ENOTDIR; + /* * If we got no result and were looking for a default * value, try hard coded defaults. diff --git a/lib/libutil/pw_getconf.3 b/lib/libutil/pw_getconf.3 index 8e1bf6375a11..3707e8d57ecd 100644 --- a/lib/libutil/pw_getconf.3 +++ b/lib/libutil/pw_getconf.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: pw_getconf.3,v 1.7 2003/04/16 13:35:15 wiz Exp $ +.\" $NetBSD: pw_getconf.3,v 1.8 2005/08/18 21:07:23 elad Exp $ .\" .\" Copyright 1997 Niels Provos .\" All rights reserved. @@ -30,7 +30,7 @@ .\" .\" from OpenBSD: pw_getconf.3,v 1.5 1999/09/21 04:52:46 csapuntz Exp .\" -.Dd July 6, 2000 +.Dd August 18, 2005 .Dt PW_GETCONF 3 .Os .Sh NAME @@ -77,6 +77,20 @@ An empty string is returned for all errors. .Bl -tag -width /etc/passwd.conf -compact .It Pa /etc/passwd.conf .El +.Sh ERRORS +.Fn pw_getconf +will fail if: +.Bl -tag -width Er +.It Bq Er ENOTDIR +If there is no key in +.Pa /etc/passwd.conf +named +.Pa key . +.It Bq Er ENOENT +If there is no option named +.Pa option +in the specified key. +.El .Sh SEE ALSO .Xr passwd 5 , .Xr passwd.conf 5