Skip to content

Commit

Permalink
Ignore errcheck: error return value of system.Umask is not checked
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Rodák <[email protected]>
  • Loading branch information
Honny1 committed Jul 3, 2024
1 parent 77d799d commit 99cd54a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 8 additions & 4 deletions pkg/archive/archive_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions pkg/chrootarchive/diff_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 99cd54a

Please sign in to comment.