mirror of https://github.com/mkerrisk/man-pages
Add NOTES text describing relationship of pw_dir and HOME and
pointing out that applications should preferentially inspect HOME
This commit is contained in:
parent
84a0a0510d
commit
6b2fc2945f
|
@ -22,7 +22,7 @@
|
|||
.\"
|
||||
.\" References consulted:
|
||||
.\" Linux libc source code
|
||||
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
|
||||
.\" Lewine's "POSIX Programmer's Guide" (O'Reilly & Associates, 1991)
|
||||
.\" 386BSD man pages
|
||||
.\"
|
||||
.\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
|
||||
|
@ -165,13 +165,13 @@ local password database file
|
|||
SVID 3, 4.3BSD, POSIX 1003.1-2003
|
||||
.SH NOTES
|
||||
The formulation given above under "RETURN VALUE" is from POSIX 1003.1-2001.
|
||||
It does not call "not found" an error, hence does not specify what value
|
||||
It does not call "not found" an error, and hence does not specify what value
|
||||
.I errno
|
||||
might have in this situation. But that makes it impossible to recognize
|
||||
errors. One might argue that according to POSIX
|
||||
.I errno
|
||||
should be left unchanged if an entry is not found. Experiments on various
|
||||
Unix-like systems shows that lots of different values occur in this
|
||||
Unix-like systems show that lots of different values occur in this
|
||||
situation: 0, ENOENT, EBADF, ESRCH, EWOULDBLOCK, EPERM and probably others.
|
||||
.\" more precisely:
|
||||
.\" AIX 5.1 - gives ESRCH
|
||||
|
@ -180,6 +180,21 @@ situation: 0, ENOENT, EBADF, ESRCH, EWOULDBLOCK, EPERM and probably others.
|
|||
.\" FreeBSD 4.8, OpenBSD 3.2, NetBSD 1.6 - give EPERM
|
||||
.\" SunOS 5.8 - gives EBADF
|
||||
.\" Tru64 5.1b, HP-UX-11i, SunOS 5.7 - give 0
|
||||
|
||||
The
|
||||
.I pw_dir
|
||||
field contains the name of the initial working directory of the user.
|
||||
Login programs use the value of this field to initialize
|
||||
the HOME environment variable for the login shell.
|
||||
An application that wants to determine its user's home directory
|
||||
should inspect the value of HOME (rather than the value
|
||||
.IR getpwuid(getuid())->pw_dir )
|
||||
since this allows the user to modify their notion of
|
||||
"the home directory" during a login session.
|
||||
To determine the (initial) home directory of another user,
|
||||
it is necessary to use
|
||||
.I getpwnam("username")->pw_dir
|
||||
or similar.
|
||||
.SH "SEE ALSO"
|
||||
.BR endpwent (3),
|
||||
.BR fgetpwent (3),
|
||||
|
|
Loading…
Reference in New Issue