diff --git a/pkg/archive/archive_linux_test.go b/pkg/archive/archive_linux_test.go index 9b56b3752f..419cb683b7 100644 --- a/pkg/archive/archive_linux_test.go +++ b/pkg/archive/archive_linux_test.go @@ -93,9 +93,11 @@ func checkFileMode(t *testing.T, path string, perm os.FileMode) { } func TestOverlayTarUntar(t *testing.T) { - oldmask, err := system.Umask(0) + oldMask, err := system.Umask(0) require.NoError(t, err) - defer system.Umask(oldmask) + defer func(oldMask int) { + _, _ = system.Umask(oldMask) // Ignore err. This can only fail with ErrNotSupportedPlatform, in which case we would have failed above. + }(oldMask) src := t.TempDir() setupOverlayTestDir(t, src) @@ -131,9 +133,11 @@ func TestOverlayTarUntar(t *testing.T) { } func TestOverlayTarAUFSUntar(t *testing.T) { - oldmask, err := system.Umask(0) + oldMask, err := system.Umask(0) require.NoError(t, err) - defer system.Umask(oldmask) + defer func(oldMask int) { + _, _ = system.Umask(oldMask) // Ignore err. This can only fail with ErrNotSupportedPlatform, in which case we would have failed above. + }(oldMask) src := t.TempDir() setupOverlayTestDir(t, src) diff --git a/pkg/chrootarchive/diff_unix.go b/pkg/chrootarchive/diff_unix.go index 71ed094d1e..1577f25acf 100644 --- a/pkg/chrootarchive/diff_unix.go +++ b/pkg/chrootarchive/diff_unix.go @@ -40,11 +40,13 @@ func applyLayer() { } // We need to be able to set any perms - oldmask, err := system.Umask(0) - defer system.Umask(oldmask) + oldMask, err := system.Umask(0) if err != nil { fatal(err) } + defer func(oldMask int) { + _, _ = system.Umask(oldMask) // Ignore err. This can only fail with ErrNotSupportedPlatform, in which case we would have failed above. + }(oldMask) if err := json.Unmarshal([]byte(os.Getenv("OPT")), &options); err != nil { fatal(err)