repo.or.cz
/
minix.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
some coverity fixes.
[minix.git]
/
lib
/
libc
/
sys-minix
/
__getlogin.c
blob
4194db6246c0b798794e307cca1833dc7237260f
1
/* getlogin(3)
2
*
3
* Author: Terrence W. Holm Aug. 1988
4
*/
5
6
#include <sys/cdefs.h>
7
#include
"namespace.h"
8
#include <lib.h>
9
10
#include <pwd.h>
11
#include <unistd.h>
12
#include <string.h>
13
#include <stdio.h>
14
#include
"extern.h"
15
16
17
18
int
__getlogin
(
char
*
logname
,
size_t
sz
)
19
{
20
struct
passwd
*
pw_entry
;
21
22
pw_entry
=
getpwuid
(
getuid
());
23
24
if
(
pw_entry
== (
struct
passwd
*)
NULL
)
25
return
0
;
26
27
strncpy
(
logname
,
pw_entry
->
pw_name
,
sz
);
28
return
sz
;
29
}