mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-23 09:23:00 +01:00
Provide the getlogin_r function.
This commit is contained in:
parent
c0da4cacd0
commit
8166f7fd4b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53859
@ -29,6 +29,8 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
@ -60,3 +62,19 @@ getlogin()
|
||||
}
|
||||
return (*logname ? logname : (char *)NULL);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
getlogin_r(char *logname, int namelen)
|
||||
{
|
||||
if (_logname_valid == 0) {
|
||||
#ifdef __NETBSD_SYSCALLS
|
||||
if (__getlogin(logname, namelen - 1) < 0)
|
||||
#else
|
||||
if (_getlogin(logname, namelen) < 0)
|
||||
#endif
|
||||
return ((char *)NULL);
|
||||
_logname_valid = 1;
|
||||
}
|
||||
return (*logname ? logname : (char *)NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user