mirror of git://gcc.gnu.org/git/gcc.git
parent
57d195e224
commit
73b5b93a59
|
|
@ -73,11 +73,14 @@ func lookup(uid int, username string, lookupByName bool) (*User, error) {
|
||||||
const bufSize = 1024
|
const bufSize = 1024
|
||||||
buf := make([]byte, bufSize)
|
buf := make([]byte, bufSize)
|
||||||
if lookupByName {
|
if lookupByName {
|
||||||
rv := libc_getpwnam_r(syscall.StringBytePtr(username),
|
p := syscall.StringBytePtr(username)
|
||||||
|
syscall.Entersyscall()
|
||||||
|
rv := libc_getpwnam_r(p,
|
||||||
&pwd,
|
&pwd,
|
||||||
&buf[0],
|
&buf[0],
|
||||||
bufSize,
|
bufSize,
|
||||||
&result)
|
&result)
|
||||||
|
syscall.Exitsyscall()
|
||||||
if rv != 0 {
|
if rv != 0 {
|
||||||
return nil, fmt.Errorf("user: lookup username %s: %s", username, syscall.GetErrno())
|
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)
|
return nil, UnknownUserError(username)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
syscall.Entersyscall()
|
||||||
rv := libc_getpwuid_r(syscall.Uid_t(uid),
|
rv := libc_getpwuid_r(syscall.Uid_t(uid),
|
||||||
&pwd,
|
&pwd,
|
||||||
&buf[0],
|
&buf[0],
|
||||||
bufSize,
|
bufSize,
|
||||||
&result)
|
&result)
|
||||||
|
syscall.Exitsyscall()
|
||||||
if rv != 0 {
|
if rv != 0 {
|
||||||
return nil, fmt.Errorf("user: lookup userid %d: %s", uid, syscall.GetErrno())
|
return nil, fmt.Errorf("user: lookup userid %d: %s", uid, syscall.GetErrno())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue