diff options
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/containers/psgo/ps/ps.go | 32 | ||||
-rw-r--r-- | vendor/github.com/containers/psgo/vendor.conf | 1 |
2 files changed, 13 insertions, 20 deletions
diff --git a/vendor/github.com/containers/psgo/ps/ps.go b/vendor/github.com/containers/psgo/ps/ps.go index a7e7cafad..b954988e5 100644 --- a/vendor/github.com/containers/psgo/ps/ps.go +++ b/vendor/github.com/containers/psgo/ps/ps.go @@ -4,13 +4,13 @@ import ( "fmt" "io/ioutil" "os" - "os/user" "runtime" "strconv" "strings" "sync" "time" + "github.com/opencontainers/runc/libcontainer/user" "github.com/pkg/errors" "golang.org/x/sys/unix" ) @@ -405,17 +405,13 @@ func parseDescriptors(input string) ([]aixFormatDescriptor, error) { // lookupGID returns the textual group ID, if it can be optained, or the // decimal input representation otherwise. func lookupGID(gid string) (string, error) { - if gid == "0" { - return "root", nil + gidNum, err := strconv.Atoi(gid) + if err != nil { + return "", errors.Wrap(err, "error parsing group ID") } - g, err := user.LookupGroupId(gid) + g, err := user.LookupGid(gidNum) if err != nil { - switch err.(type) { - case user.UnknownGroupIdError: - return gid, nil - default: - return "", err - } + return gid, nil } return g.Name, nil } @@ -442,19 +438,15 @@ func processPPID(p *process) (string, error) { // lookupUID return the textual user ID, if it can be optained, or the decimal // input representation otherwise. func lookupUID(uid string) (string, error) { - if uid == "0" { - return "root", nil + uidNum, err := strconv.Atoi(uid) + if err != nil { + return "", errors.Wrap(err, "error parsing user ID") } - u, err := user.LookupId(uid) + u, err := user.LookupUid(uidNum) if err != nil { - switch err.(type) { - case user.UnknownUserError: - return uid, nil - default: - return "", err - } + return uid, nil } - return u.Username, nil + return u.Name, nil } diff --git a/vendor/github.com/containers/psgo/vendor.conf b/vendor/github.com/containers/psgo/vendor.conf index ebdb065ef..1fba46ec1 100644 --- a/vendor/github.com/containers/psgo/vendor.conf +++ b/vendor/github.com/containers/psgo/vendor.conf @@ -1,4 +1,5 @@ github.com/davecgh/go-spew master +github.com/opencontainers/runc master github.com/pkg/errors master github.com/pmezard/go-difflib master github.com/sirupsen/logrus master |