mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-29 07:10:24 +08:00
os/user: Use Entersyscall.
From-SVN: r188496
This commit is contained in:
parent
57d195e224
commit
73b5b93a59
@ -73,11 +73,14 @@ func lookup(uid int, username string, lookupByName bool) (*User, error) {
|
||||
const bufSize = 1024
|
||||
buf := make([]byte, bufSize)
|
||||
if lookupByName {
|
||||
rv := libc_getpwnam_r(syscall.StringBytePtr(username),
|
||||
p := syscall.StringBytePtr(username)
|
||||
syscall.Entersyscall()
|
||||
rv := libc_getpwnam_r(p,
|
||||
&pwd,
|
||||
&buf[0],
|
||||
bufSize,
|
||||
&result)
|
||||
syscall.Exitsyscall()
|
||||
if rv != 0 {
|
||||
return nil, fmt.Errorf("user: lookup username %s: %s", username, syscall.GetErrno())
|
||||
}
|
||||
@ -85,11 +88,13 @@ func lookup(uid int, username string, lookupByName bool) (*User, error) {
|
||||
return nil, UnknownUserError(username)
|
||||
}
|
||||
} else {
|
||||
syscall.Entersyscall()
|
||||
rv := libc_getpwuid_r(syscall.Uid_t(uid),
|
||||
&pwd,
|
||||
&buf[0],
|
||||
bufSize,
|
||||
&result)
|
||||
syscall.Exitsyscall()
|
||||
if rv != 0 {
|
||||
return nil, fmt.Errorf("user: lookup userid %d: %s", uid, syscall.GetErrno())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user