提交 09fbecef 编写于 作者: J Johan Walles

Darwin: Remove questionable UIDs

process.Process.uids is an array of undocumented values.

That one of them is the user that the process is running as is obvious, but what
the other two are supposed to be is AFAICT undocumented.

On Darwin, the second and third UID (out of three) seem to always be 0.

This change removes the two always-zero UIDs from the process.Process struct on
Darwin, and leaves just the one that actually identifies the user the process
is running as.
上级 e3a7a454
......@@ -125,18 +125,10 @@ func (p *Process) Uids() ([]int32, error) {
return nil, err
}
uids := make([]int32, 0, 3)
// See: http://unix.superglobalmegacorp.com/Net2/newsrc/sys/ucred.h.html
userEffectiveUID := int32(k.Eproc.Ucred.Uid)
// See: http://unix.superglobalmegacorp.com/Net2/newsrc/sys/proc.h.html
procRealUID := int32(k.Eproc.Pcred.P_ruid)
procSavedEffectiveUID := int32(k.Eproc.Pcred.P_svuid)
uids = append(uids, userEffectiveUID, procRealUID, procSavedEffectiveUID)
return uids, nil
return []int32{userEffectiveUID}, nil
}
func (p *Process) Gids() ([]int32, error) {
k, err := p.getKProc()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册