mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-01 22:57:29 -04:00
unix: add PrctlRetInt, a Prctl variant that returns (int, error)
Fixes golang/go#35978 Change-Id: I396f0c2c6443e000bcecc9081841cd55145c050b GitHub-Last-Rev: d461448006fb6d35b1942177e1d006d67fd2b8b5 GitHub-Pull-Request: golang/sys#48 Reviewed-on: https://go-review.googlesource.com/c/sys/+/209969 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
committed by
Tobias Klauser
parent
ac6580df44
commit
4a24b40652
@@ -686,3 +686,17 @@ func TestEpoll(t *testing.T) {
|
||||
t.Errorf("EpollWait: wrong Fd in event: got %v, expected %v", got, fd)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrctlRetInt(t *testing.T) {
|
||||
err := unix.Prctl(unix.PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)
|
||||
if err != nil {
|
||||
t.Skipf("Prctl: %v, skipping test", err)
|
||||
}
|
||||
v, err := unix.PrctlRetInt(unix.PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to perform prctl: %v", err)
|
||||
}
|
||||
if v != 1 {
|
||||
t.Fatalf("unexpected return from prctl; got %v, expected %v", v, 1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user