diff options
author | Valentin Rothberg <vrothberg@redhat.com> | 2022-03-21 14:49:47 +0100 |
---|---|---|
committer | Valentin Rothberg <vrothberg@redhat.com> | 2022-03-22 13:04:35 +0100 |
commit | 0f12b6fe55f6b5ce70d8c388ec2df35db9feffbb (patch) | |
tree | 1fb296cb38e545e367824532bc0e3d2a8ace6a54 /pkg/rootless | |
parent | 081e09143747b01c15071ba1bf80cafe60f5818e (diff) | |
download | podman-0f12b6fe55f6b5ce70d8c388ec2df35db9feffbb.tar.gz podman-0f12b6fe55f6b5ce70d8c388ec2df35db9feffbb.tar.bz2 podman-0f12b6fe55f6b5ce70d8c388ec2df35db9feffbb.zip |
linter: enable nilerr
A number of cases looked suspicious, so I marked them with `FIXME`s to
leave some breadcrumbs.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'pkg/rootless')
-rw-r--r-- | pkg/rootless/rootless.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/rootless/rootless.go b/pkg/rootless/rootless.go index 93b4e2e9f..f526aa9e1 100644 --- a/pkg/rootless/rootless.go +++ b/pkg/rootless/rootless.go @@ -16,12 +16,15 @@ import ( // file. func TryJoinPauseProcess(pausePidPath string) (bool, int, error) { if _, err := os.Stat(pausePidPath); err != nil { - return false, -1, nil + if os.IsNotExist(err) { + return false, -1, nil + } + return false, -1, err } became, ret, err := TryJoinFromFilePaths("", false, []string{pausePidPath}) if err == nil { - return became, ret, err + return became, ret, nil } // It could not join the pause process, let's lock the file before trying to delete it. @@ -46,7 +49,7 @@ func TryJoinPauseProcess(pausePidPath string) (bool, int, error) { if err != nil { // It is still failing. We can safely remove it. os.Remove(pausePidPath) - return false, -1, nil + return false, -1, nil // nolint: nilerr } return became, ret, err } |