mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Merge pull request #2762 from giuseppe/rootless-exec-old-containers-uidmap
rootless: fix regression when using exec on old containers
This commit is contained in:
@ -112,14 +112,19 @@ func execCmd(c *cliconfig.ExecValues) error {
|
||||
var ret int
|
||||
|
||||
data, err := ioutil.ReadFile(ctr.Config().ConmonPidFile)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "cannot read conmon PID file %q", ctr.Config().ConmonPidFile)
|
||||
}
|
||||
if err == nil {
|
||||
conmonPid, err := strconv.Atoi(string(data))
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "cannot parse PID %q", data)
|
||||
}
|
||||
became, ret, err = rootless.JoinDirectUserAndMountNS(uint(conmonPid))
|
||||
} else {
|
||||
pid, err := ctr.PID()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
became, ret, err = rootless.JoinNS(uint(pid), c.PreserveFDs)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user