From 4c5bf649d01e3b3703e05d0563c0fd9e68eaa0a5 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 17 Aug 2017 11:41:19 +0200 Subject: [PATCH] Check error return values Both tty.resize and notifySocket.setupSocket return an error which isn't handled in the caller. Fix this and either log or propagate the errors. Found using https://github.com/mvdan/unparam Signed-off-by: Tobias Klauser --- signals.go | 8 ++++++-- utils_linux.go | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/signals.go b/signals.go index bef0ff42..a0b918f8 100644 --- a/signals.go +++ b/signals.go @@ -75,11 +75,15 @@ func (h *signalHandler) forward(process *libcontainer.Process, tty *tty, detach } // perform the initial tty resize. - tty.resize() + if err := tty.resize(); err != nil { + logrus.Error(err) + } for s := range h.signals { switch s { case unix.SIGWINCH: - tty.resize() + if err := tty.resize(); err != nil { + logrus.Error(err) + } case unix.SIGCHLD: exits, err := h.reap() if err != nil { diff --git a/utils_linux.go b/utils_linux.go index eb812892..6f6ff58e 100644 --- a/utils_linux.go +++ b/utils_linux.go @@ -371,7 +371,10 @@ func startContainer(context *cli.Context, spec *specs.Spec, action CtAct, criuOp } if notifySocket != nil { - notifySocket.setupSocket() + err := notifySocket.setupSocket() + if err != nil { + return -1, err + } } // Support on-demand socket activation by passing file descriptors into the container init process.