diff options
-rw-r--r-- | libpod/container_api.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 5ebb7b091..bfe20b184 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -376,14 +376,18 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e logrus.Debugf("Successfully started exec session %s in container %s", sessionID, c.ID()) // Unlock so other processes can use the container - c.lock.Unlock() - locked = false + if !c.locked { + c.lock.Unlock() + locked = false + } waitErr := execCmd.Wait() // Lock again - locked = true - c.lock.Lock() + if !c.locked { + locked = true + c.lock.Lock() + } // Sync the container again to pick up changes in state if err := c.syncContainer(); err != nil { |