mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #3995 from kolyshkin/rm-unix-nolint
bump golangci-lint; remove nolint annotations for unix errno comparisons
This commit is contained in:
@@ -40,7 +40,7 @@ jobs:
|
||||
sudo apt -q install libseccomp-dev
|
||||
- uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: v1.53
|
||||
version: v1.54
|
||||
# Extra linters, only checking new code from a pull request.
|
||||
- name: lint-extra
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
@@ -89,7 +89,7 @@ func prepareOpenat2() error {
|
||||
})
|
||||
if err != nil {
|
||||
prepErr = &os.PathError{Op: "openat2", Path: cgroupfsDir, Err: err}
|
||||
if err != unix.ENOSYS { //nolint:errorlint // unix errors are bare
|
||||
if err != unix.ENOSYS {
|
||||
logrus.Warnf("falling back to securejoin: %s", prepErr)
|
||||
} else {
|
||||
logrus.Debug("openat2 not available, falling back to securejoin")
|
||||
|
||||
@@ -195,7 +195,7 @@ func cpusetEnsureParent(current string) error {
|
||||
}
|
||||
// Treat non-existing directory as cgroupfs as it will be created,
|
||||
// and the root cpuset directory obviously exists.
|
||||
if err != nil && err != unix.ENOENT { //nolint:errorlint // unix errors are bare
|
||||
if err != nil && err != unix.ENOENT {
|
||||
return &os.PathError{Op: "statfs", Path: parent, Err: err}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ func PathExists(path string) bool {
|
||||
|
||||
func rmdir(path string) error {
|
||||
err := unix.Rmdir(path)
|
||||
if err == nil || err == unix.ENOENT { //nolint:errorlint // unix errors are bare
|
||||
if err == nil || err == unix.ENOENT {
|
||||
return nil
|
||||
}
|
||||
return &os.PathError{Op: "rmdir", Path: path, Err: err}
|
||||
|
||||
@@ -593,7 +593,7 @@ func (c *Container) prepareCriuRestoreMounts(mounts []*configs.Mount) error {
|
||||
for _, u := range umounts {
|
||||
_ = utils.WithProcfd(c.config.Rootfs, u, func(procfd string) error {
|
||||
if e := unix.Unmount(procfd, unix.MNT_DETACH); e != nil {
|
||||
if e != unix.EINVAL { //nolint:errorlint // unix errors are bare
|
||||
if e != unix.EINVAL {
|
||||
// Ignore EINVAL as it means 'target is not a mount point.'
|
||||
// It probably has already been unmounted.
|
||||
logrus.Warnf("Error during cleanup unmounting of %s (%s): %v", procfd, u, e)
|
||||
|
||||
@@ -642,7 +642,7 @@ func signalAllProcesses(m cgroups.Manager, s unix.Signal) error {
|
||||
}
|
||||
for _, pid := range pids {
|
||||
err := unix.Kill(pid, s)
|
||||
if err != nil && err != unix.ESRCH { //nolint:errorlint // unix errors are bare
|
||||
if err != nil && err != unix.ESRCH {
|
||||
logrus.Warnf("kill %d: %v", pid, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +322,6 @@ type CreateOpts struct {
|
||||
func getwd() (wd string, err error) {
|
||||
for {
|
||||
wd, err = unix.Getwd()
|
||||
//nolint:errorlint // unix errors are bare
|
||||
if err != unix.EINTR {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ func Execv(cmd string, args []string, env []string) error {
|
||||
func Exec(cmd string, args []string, env []string) error {
|
||||
for {
|
||||
err := unix.Exec(cmd, args, env)
|
||||
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
|
||||
if err != unix.EINTR {
|
||||
return &os.PathError{Op: "exec", Path: cmd, Err: err}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -215,7 +215,7 @@ func sdNotifyBarrier(client *net.UnixConn) error {
|
||||
// Probably the other end doesn't support the sd_notify_barrier protocol.
|
||||
logrus.Warn("Timeout after waiting 30s for barrier. Ignored.")
|
||||
return nil
|
||||
} else if err == io.EOF { //nolint:errorlint // comparison with io.EOF is legit.
|
||||
} else if err == io.EOF { //nolint:errorlint // https://github.com/polyfloyd/go-errorlint/issues/49
|
||||
return nil
|
||||
} else {
|
||||
return err
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ func (h *signalHandler) reap() (exits []exit, err error) {
|
||||
for {
|
||||
pid, err := unix.Wait4(-1, &ws, unix.WNOHANG, &rus)
|
||||
if err != nil {
|
||||
if err == unix.ECHILD { //nolint:errorlint // unix errors are bare
|
||||
if err == unix.ECHILD {
|
||||
return exits, nil
|
||||
}
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user