mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Small fixes
This commit is contained in:
parent
1a1be5a87c
commit
b843998718
2 changed files with 13 additions and 12 deletions
10
api_test.go
10
api_test.go
|
@ -336,9 +336,11 @@ func TestGetContainersJSON(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
r := httptest.NewRecorder()
|
r := httptest.NewRecorder()
|
||||||
if err := getContainersJSON(srv, APIVERSION, r, req, nil); err != nil {
|
setTimeout(t, "getContainerJSON timed out", 5*time.Second, func() {
|
||||||
t.Fatal(err)
|
if err := getContainersJSON(srv, APIVERSION, r, req, nil); err != nil {
|
||||||
}
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
containers := []APIContainers{}
|
containers := []APIContainers{}
|
||||||
if err := json.Unmarshal(r.Body.Bytes(), &containers); err != nil {
|
if err := json.Unmarshal(r.Body.Bytes(), &containers); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -374,7 +376,7 @@ func TestGetContainersExport(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
r := httptest.NewRecorder()
|
r := httptest.NewRecorder()
|
||||||
if err = getContainersExport(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
|
if err := getContainersExport(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
image.go
15
image.go
|
@ -310,7 +310,7 @@ func (image *Image) applyLayer(layer, target string) error {
|
||||||
update := updateTimes[i]
|
update := updateTimes[i]
|
||||||
|
|
||||||
O_PATH := 010000000 // Not in syscall yet
|
O_PATH := 010000000 // Not in syscall yet
|
||||||
var err error = nil
|
var err error
|
||||||
if update.mode&syscall.S_IFLNK == syscall.S_IFLNK {
|
if update.mode&syscall.S_IFLNK == syscall.S_IFLNK {
|
||||||
// Update time on the symlink via O_PATH + futimes(), if supported by the kernel
|
// Update time on the symlink via O_PATH + futimes(), if supported by the kernel
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ func (image *Image) applyLayer(layer, target string) error {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
syscall.Futimes(fd, update.time)
|
syscall.Futimes(fd, update.time)
|
||||||
_ = syscall.Close(fd)
|
syscall.Close(fd)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = syscall.Utimes(update.path, update.time)
|
err = syscall.Utimes(update.path, update.time)
|
||||||
|
@ -411,8 +411,8 @@ func (image *Image) ensureImageDevice(devices DeviceSet) error {
|
||||||
// part of the container changes
|
// part of the container changes
|
||||||
dockerinitLayer, err := image.getDockerInitLayer()
|
dockerinitLayer, err := image.getDockerInitLayer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = devices.UnmountDevice(image.ID, mountDir)
|
devices.UnmountDevice(image.ID, mountDir)
|
||||||
_ = devices.RemoveDevice(image.ID)
|
devices.RemoveDevice(image.ID)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,8 +491,7 @@ func (image *Image) Unmount(runtime *Runtime, root string, id string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = devices.UnmountDevice(id, root)
|
if err = devices.UnmountDevice(id, root); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,9 +518,9 @@ func (image *Image) Changes(runtime *Runtime, root, rw, id string) ([]Change, er
|
||||||
}
|
}
|
||||||
|
|
||||||
changes, err := ChangesDirs(root, rw)
|
changes, err := ChangesDirs(root, rw)
|
||||||
_ = devices.UnmountDevice(image.ID, rw)
|
devices.UnmountDevice(image.ID, rw)
|
||||||
if !wasActivated {
|
if !wasActivated {
|
||||||
_ = devices.DeactivateDevice(image.ID)
|
devices.DeactivateDevice(image.ID)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Add table
Reference in a new issue