summaryrefslogtreecommitdiffstats
path: root/man3/getlogin.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/getlogin.3')
-rw-r--r--man3/getlogin.332
1 files changed, 16 insertions, 16 deletions
diff --git a/man3/getlogin.3 b/man3/getlogin.3
index 5b88d77..bdf8376 100644
--- a/man3/getlogin.3
+++ b/man3/getlogin.3
@@ -6,7 +6,7 @@
.\" Changed Tue Sep 19 01:49:29 1995, aeb: moved from man2 to man3
.\" added ref to /etc/utmp, added BUGS section, etc.
.\" modified 2003 Walter Harms, aeb - added getlogin_r, note on stdin use
-.TH getlogin 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH getlogin 3 2023-10-31 "Linux man-pages 6.7"
.SH NAME
getlogin, getlogin_r, cuserid \- get username
.SH LIBRARY
@@ -15,26 +15,26 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <unistd.h>
-.PP
+.P
.B "char *getlogin(void);"
.BI "int getlogin_r(char " buf [. bufsize "], size_t " bufsize );
-.PP
+.P
.B #include <stdio.h>
-.PP
+.P
.BI "char *cuserid(char *" string );
.fi
-.PP
+.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
-.PP
+.P
.BR getlogin_r ():
.nf
.\" Deprecated: _REENTRANT ||
_POSIX_C_SOURCE >= 199506L
.fi
-.PP
+.P
.BR cuserid ():
.nf
Since glibc 2.24:
@@ -52,13 +52,13 @@ The string is
statically allocated and might be overwritten on subsequent calls to
this function or to
.BR cuserid ().
-.PP
+.P
.BR getlogin_r ()
returns this same username in the array
.I buf
of size
.IR bufsize .
-.PP
+.P
.BR cuserid ()
returns a pointer to a string containing a username
associated with the effective user ID of the process.
@@ -70,18 +70,18 @@ This
string is statically allocated and might be overwritten on subsequent
calls to this function or to
.BR getlogin ().
-.PP
+.P
The macro \fBL_cuserid\fP is an integer constant that indicates how
long an array you might need to store a username.
\fBL_cuserid\fP is declared in \fI<stdio.h>\fP.
-.PP
+.P
These functions let your program identify positively the user who is
running
.RB ( cuserid ())
or the user who logged in this session
.RB ( getlogin ()).
(These can differ when set-user-ID programs are involved.)
-.PP
+.P
For most purposes, it is more useful to use the environment variable
\fBLOGNAME\fP to find out who the user is.
This is more flexible
@@ -111,7 +111,7 @@ The calling process has no controlling terminal.
The length of the username, including the terminating null byte (\[aq]\e0\[aq]),
is larger than
.IR bufsize .
-.PP
+.P
Linux/glibc also has:
.TP
.B ENOENT
@@ -169,7 +169,7 @@ T} Thread safety T{
MT-Unsafe race:cuserid/!string locale
T}
.TE
-.sp 1
+.P
In the above table,
.I utent
in
@@ -232,7 +232,7 @@ of our program need not be the user who started it.
Avoid
.BR getlogin ()
for security-related purposes.
-.PP
+.P
Note that glibc does not follow the POSIX specification and uses
.I stdin
instead of
@@ -242,7 +242,7 @@ A bug.
all return the login name also when
.I stdin
is redirected.)
-.PP
+.P
Nobody knows precisely what
.BR cuserid ()
does; avoid it in portable programs.