Make pw_getconf(3) set errno so we have indication on what went wrong.
Document possible errno values in the manpage.
This commit is contained in:
parent
f55b2b19ea
commit
dd3453b45c
|
@ -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
|
* Copyright (c) 1987, 1993, 1994, 1995
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#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 */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -577,6 +577,11 @@ pw_getconf(char *data, size_t max, const char *key, const char *option)
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
errno = ENOENT;
|
||||||
|
if (!got)
|
||||||
|
errno = ENOTDIR;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we got no result and were looking for a default
|
* If we got no result and were looking for a default
|
||||||
* value, try hard coded defaults.
|
* value, try hard coded defaults.
|
||||||
|
|
|
@ -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 <provos@physnet.uni-hamburg.de>
|
.\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
.\"
|
.\"
|
||||||
.\" from OpenBSD: pw_getconf.3,v 1.5 1999/09/21 04:52:46 csapuntz Exp
|
.\" 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
|
.Dt PW_GETCONF 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -77,6 +77,20 @@ An empty string is returned for all errors.
|
||||||
.Bl -tag -width /etc/passwd.conf -compact
|
.Bl -tag -width /etc/passwd.conf -compact
|
||||||
.It Pa /etc/passwd.conf
|
.It Pa /etc/passwd.conf
|
||||||
.El
|
.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
|
.Sh SEE ALSO
|
||||||
.Xr passwd 5 ,
|
.Xr passwd 5 ,
|
||||||
.Xr passwd.conf 5
|
.Xr passwd.conf 5
|
||||||
|
|
Loading…
Reference in New Issue