Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
mounts: Fix bug while checking if /dev was bind-mounted
Browse files Browse the repository at this point in the history
There was a bug in the way we were checking if /dev was
bindmounted from the host.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
  • Loading branch information
amshinde committed Jan 5, 2018
1 parent 78e617b commit 4c2c9a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,11 @@ func (c *Container) fetchState(cmd string) (State, error) {

func (c *Container) getSystemMountInfo() {
// check if /dev needs to be bind mounted from host /dev
c.systemMountsInfo.BindMountDev = false

for _, m := range c.mounts {
if m.Source == "/dev" && m.Destination == "/dev" && m.Type == "bind" {
c.systemMountsInfo.BindMountDev = true
} else {
c.systemMountsInfo.BindMountDev = false
}
}

Expand Down
5 changes: 5 additions & 0 deletions container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ func TestContainerSystemMountsInfo(t *testing.T) {
Destination: "/dev",
Type: "bind",
},
{
Source: "procfs",
Destination: "/proc",
Type: "procfs",
},
}

c := Container{
Expand Down

0 comments on commit 4c2c9a4

Please sign in to comment.