Document the getlogin_r function.
This commit is contained in:
parent
8166f7fd4b
commit
4d3be89f2a
@ -37,12 +37,16 @@
|
||||
.Os BSD 4.4
|
||||
.Sh NAME
|
||||
.Nm getlogin ,
|
||||
.Nm getlogin_r ,
|
||||
.Nm setlogin
|
||||
.Nd get/set login name
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <unistd.h>
|
||||
.Ft char *
|
||||
.Fn getlogin void
|
||||
.Fd #include <sys/param.h>
|
||||
.Ft char *
|
||||
.Fn getlogin_r "char *name" "int len"
|
||||
.Ft int
|
||||
.Fn setlogin "const char *name"
|
||||
.Sh DESCRIPTION
|
||||
@ -60,6 +64,18 @@ for example when
|
||||
.Xr su 1
|
||||
is used).
|
||||
.Pp
|
||||
.Fn getlogin_r
|
||||
provides the same service as
|
||||
.Fn getlogin
|
||||
except the caller must provide the buffer
|
||||
.Fa name
|
||||
with length
|
||||
.Fa len
|
||||
bytes
|
||||
to hold the result. The buffer should be at least
|
||||
.Dv MAXLOGNAME
|
||||
bytes in length.
|
||||
.Pp
|
||||
.Fn Setlogin
|
||||
sets the login name of the user associated with the current session to
|
||||
.Fa name .
|
||||
@ -115,8 +131,12 @@ precautions to prevent security violations.
|
||||
If a call to
|
||||
.Fn getlogin
|
||||
succeeds, it returns a pointer to a null-terminated string in a static buffer.
|
||||
If the name has not been set, it returns
|
||||
.Dv NULL .
|
||||
.Fn getlogin_r
|
||||
returns a pointer to the buffer passed in by the caller on success.
|
||||
Both return
|
||||
.Dv NULL
|
||||
if the name has not been set.
|
||||
.Pp
|
||||
If a call to
|
||||
.Fn setlogin
|
||||
succeeds, a value of 0 is returned. If
|
||||
|
Loading…
Reference in New Issue
Block a user