Skip to content

Commit b1a3617

Browse files
committed
Fix typo and nit
Signed-off-by: Min Uk Lee <[email protected]>
1 parent 7647f5d commit b1a3617

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

pkg/cmd/container/create.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,9 @@ func generateGcFunc(ctx context.Context, container containerd.Container, ns, id,
710710
if ipcErr != nil {
711711
log.G(ctx).WithError(ipcErr).Warnf("failed to decode ipc label for container %q", id)
712712
}
713-
ipcutil.CleanUp(ipc)
713+
if ipcErr := ipcutil.CleanUp(ipc); ipcErr != nil {
714+
log.G(ctx).WithError(ipcErr).Warnf("failed to clean up ipc for container %q", id)
715+
}
714716
if rmErr := os.RemoveAll(internalLabels.stateDir); rmErr != nil {
715717
log.G(ctx).WithError(rmErr).Warnf("failed to remove container %q state dir %q", id, internalLabels.stateDir)
716718
}

pkg/containerutil/containerutil.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,10 @@ func Stop(ctx context.Context, container containerd.Container, timeout *time.Dur
340340
if err != nil {
341341
return err
342342
}
343-
defer ipcutil.CleanUp(ipc)
344-
345343
// defer umount
346344
defer func() {
347-
if err != nil {
348-
log.G(ctx).Warnf("Cannot unmount shm container %s: %s", container.ID(), err)
345+
if err := ipcutil.CleanUp(ipc); err != nil {
346+
log.G(ctx).Warnf("failed to clean up IPC container %s: %s", container.ID(), err)
349347
}
350348
}()
351349

pkg/ipcutil/ipcutil_linux.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@
1919
package ipcutil
2020

2121
import (
22+
"fmt"
2223
"os"
23-
"strconv"
2424

2525
"github.com/docker/go-units"
2626
"golang.org/x/sys/unix"
2727
)
2828

2929
// makeShareableDevshm returns devshm directory path on host when there is no error.
30-
func makeShareableDevshm(shmPath string, shmSize string) error {
30+
func makeShareableDevshm(shmPath, shmSize string) error {
3131
shmproperty := "mode=1777"
3232
if len(shmSize) > 0 {
3333
shmBytes, err := units.RAMInBytes(shmSize)
3434
if err != nil {
3535
return err
3636
}
37-
shmproperty += ",size=" + strconv.FormatInt(shmBytes, 10)
37+
shmproperty = fmt.Sprintf("%s,size=%d", shmproperty, shmBytes)
3838
}
39-
err := os.MkdirAll(shmPath, 0o700)
39+
err := os.MkdirAll(shmPath, 0700)
4040
if err != nil {
4141
return err
4242
}

pkg/ipcutil/ipcutil_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package ipcutil
2121
import "fmt"
2222

2323
// makeShareableDevshm returns devshm directory path on host when there is no error.
24-
func makeShareableDevshm(shmPath string, shmSize string) error {
24+
func makeShareableDevshm(shmPath, shmSize string) error {
2525
return fmt.Errorf("unix does not support shareable devshm")
2626
}
2727

pkg/ipcutil/ipcutil_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ package ipcutil
1919
import "fmt"
2020

2121
// makeShareableDevshm returns devshm directory path on host when there is no error.
22-
func makeShareableDevshm(shmPath string, shmSize string) error {
22+
func makeShareableDevshm(shmPath, shmSize string) error {
2323
return fmt.Errorf("windows does not support shareable devshm")
2424
}
2525

2626
// cleanUpPlatformSpecificIPC cleans up platform specific IPC.
2727
func cleanUpPlatformSpecificIPC(ipc IPC) error {
2828
if ipc.Mode == Shareable {
29-
return fmt.Errorf("unix does not support shareable devshm")
29+
return fmt.Errorf("windows does not support shareable devshm")
3030
}
3131
return nil
3232
}

0 commit comments

Comments
 (0)