mirror of
https://github.com/containers/podman.git
synced 2025-06-28 22:53:21 +08:00
golangci-lint cleanup
a PR slipped through without running the new linter. this cleans things up for the master branch. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@ -188,7 +188,9 @@ func setupStdioChannels(streams *AttachStreams, conn *net.UnixConn, detachKeys [
|
|||||||
var err error
|
var err error
|
||||||
if streams.AttachInput {
|
if streams.AttachInput {
|
||||||
_, err = utils.CopyDetachable(conn, streams.InputStream, detachKeys)
|
_, err = utils.CopyDetachable(conn, streams.InputStream, detachKeys)
|
||||||
conn.CloseWrite()
|
if connErr := conn.CloseWrite(); connErr != nil {
|
||||||
|
logrus.Errorf("unable to close conn: %q", connErr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stdinDone <- err
|
stdinDone <- err
|
||||||
}()
|
}()
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containers/libpod/libpod/define"
|
"github.com/containers/libpod/libpod/define"
|
||||||
"github.com/containers/libpod/pkg/cgroups"
|
"github.com/containers/libpod/pkg/cgroups"
|
||||||
|
"github.com/containers/libpod/pkg/errorhandling"
|
||||||
"github.com/containers/libpod/pkg/lookup"
|
"github.com/containers/libpod/pkg/lookup"
|
||||||
"github.com/containers/libpod/pkg/util"
|
"github.com/containers/libpod/pkg/util"
|
||||||
"github.com/containers/libpod/utils"
|
"github.com/containers/libpod/utils"
|
||||||
@ -44,14 +45,14 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Containe
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error creating socket pair")
|
return errors.Wrapf(err, "error creating socket pair")
|
||||||
}
|
}
|
||||||
defer parentSyncPipe.Close()
|
defer errorhandling.CloseQuiet(parentSyncPipe)
|
||||||
|
|
||||||
childStartPipe, parentStartPipe, err := newPipe()
|
childStartPipe, parentStartPipe, err := newPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error creating socket pair for start pipe")
|
return errors.Wrapf(err, "error creating socket pair for start pipe")
|
||||||
}
|
}
|
||||||
|
|
||||||
defer parentStartPipe.Close()
|
defer errorhandling.CloseQuiet(parentStartPipe)
|
||||||
|
|
||||||
var ociLog string
|
var ociLog string
|
||||||
if logrus.GetLevel() != logrus.DebugLevel && r.supportsJSON {
|
if logrus.GetLevel() != logrus.DebugLevel && r.supportsJSON {
|
||||||
@ -273,7 +274,7 @@ func (r *OCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, pidPath
|
|||||||
logDriver = JournaldLogging
|
logDriver = JournaldLogging
|
||||||
case JSONLogging:
|
case JSONLogging:
|
||||||
fallthrough
|
fallthrough
|
||||||
default:
|
default: //nolint-stylecheck
|
||||||
// No case here should happen except JSONLogging, but keep this here in case the options are extended
|
// No case here should happen except JSONLogging, but keep this here in case the options are extended
|
||||||
logrus.Errorf("%s logging specified but not supported. Choosing k8s-file logging instead", ctr.LogDriver())
|
logrus.Errorf("%s logging specified but not supported. Choosing k8s-file logging instead", ctr.LogDriver())
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -336,7 +337,9 @@ func startCommandGivenSelinux(cmd *exec.Cmd) error {
|
|||||||
err = cmd.Start()
|
err = cmd.Start()
|
||||||
// Ignore error returned from SetProcessLabel("") call,
|
// Ignore error returned from SetProcessLabel("") call,
|
||||||
// can't recover.
|
// can't recover.
|
||||||
label.SetProcessLabel("")
|
if labelErr := label.SetProcessLabel(""); labelErr != nil {
|
||||||
|
logrus.Errorf("unable to set process label: %q", err)
|
||||||
|
}
|
||||||
runtime.UnlockOSThread()
|
runtime.UnlockOSThread()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,11 @@ func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, tty, privileged b
|
|||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
defer cancel()
|
defer cancel()
|
||||||
defer restoreTerminal(oldTermState)
|
defer func() {
|
||||||
|
if err := restoreTerminal(oldTermState); err != nil {
|
||||||
|
logrus.Errorf("unable to restore terminal: %q", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
return ctr.Exec(tty, privileged, env, cmd, user, workDir, streams, preserveFDs, resize, detachKeys)
|
return ctr.Exec(tty, privileged, env, cmd, user, workDir, streams, preserveFDs, resize, detachKeys)
|
||||||
}
|
}
|
||||||
@ -121,7 +125,7 @@ func handleTerminalAttach(ctx context.Context, resize chan remotecommand.Termina
|
|||||||
|
|
||||||
logrus.SetFormatter(&RawTtyFormatter{})
|
logrus.SetFormatter(&RawTtyFormatter{})
|
||||||
if _, err := term.SetRawTerminal(os.Stdin.Fd()); err != nil {
|
if _, err := term.SetRawTerminal(os.Stdin.Fd()); err != nil {
|
||||||
return nil, nil, err
|
return cancel, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cancel, oldTermState, nil
|
return cancel, oldTermState, nil
|
||||||
|
Reference in New Issue
Block a user