Skip to content

Commit

Permalink
setup-user: use syscall instead of libcontainer/system
Browse files Browse the repository at this point in the history
Since Go 1.16, [Go issue 1435][1] is solved, and the stdlib syscall
implementations work on Linux. While they are a bit more
flexible/heavier-weight than the implementations that were copied to
libcontainer/system (working across all threads), we compile with Cgo,
and using the libc wrappers should be just as suitable.

  [1]: golang/go#1435

Signed-off-by: Bjorn Neergaard <[email protected]>
  • Loading branch information
neersighted committed Oct 11, 2023
1 parent 7059acb commit 9fd02c4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions setup-user.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"os"
"syscall"

"github.com/opencontainers/runc/libcontainer/system"
"github.com/opencontainers/runc/libcontainer/user"
)

Expand Down Expand Up @@ -35,10 +34,10 @@ func SetupUser(u string) error {
if err := syscall.Setgroups(execUser.Sgids); err != nil {
return err
}
if err := system.Setgid(execUser.Gid); err != nil {
if err := syscall.Setgid(execUser.Gid); err != nil {
return err
}
if err := system.Setuid(execUser.Uid); err != nil {
if err := syscall.Setuid(execUser.Uid); err != nil {
return err
}
// if we didn't get HOME already, set it based on the user's HOME
Expand Down

0 comments on commit 9fd02c4

Please sign in to comment.