From c54f1495e3d9202daf3ff3d88faa8c906e616873 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Fri, 6 Jan 2017 16:21:23 -0800 Subject: [PATCH] Fix error shadow and error check warnings Signed-off-by: Mrunal Patel --- delete.go | 4 ++-- restore.go | 6 +++--- utils_linux.go | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/delete.go b/delete.go index 295daa781..21d7656a2 100644 --- a/delete.go +++ b/delete.go @@ -14,7 +14,7 @@ import ( ) func killContainer(container libcontainer.Container) error { - container.Signal(syscall.SIGKILL, false) + _ = container.Signal(syscall.SIGKILL, false) for i := 0; i < 100; i++ { time.Sleep(100 * time.Millisecond) if err := container.Signal(syscall.Signal(0), false); err != nil { @@ -61,7 +61,7 @@ status of "ubuntu01" as "stopped" the following will delete resources held for // if there was an aborted start or something of the sort then the container's directory could exist but // libcontainer does not see it because the state.json file inside that directory was never created. path := filepath.Join(context.GlobalString("root"), id) - if err := os.RemoveAll(path); err != nil { + if err = os.RemoveAll(path); err != nil { fmt.Fprintf(os.Stderr, "remove %s: %v\n", path, err) } fmt.Fprintf(os.Stderr, "container %s does not exist\n", id) diff --git a/restore.go b/restore.go index cb6f71182..91b1efe56 100644 --- a/restore.go +++ b/restore.go @@ -150,7 +150,7 @@ func restoreContainer(context *cli.Context, spec *specs.Spec, config *configs.Co setManageCgroupsMode(context, options) - if err := setEmptyNsMask(context, options); err != nil { + if err = setEmptyNsMask(context, options); err != nil { return -1, err } @@ -176,8 +176,8 @@ func restoreContainer(context *cli.Context, spec *specs.Spec, config *configs.Co } if pidFile := context.String("pid-file"); pidFile != "" { if err := createPidFile(pidFile, process); err != nil { - process.Signal(syscall.SIGKILL) - process.Wait() + _ = process.Signal(syscall.SIGKILL) + _, _ = process.Wait() return -1, err } } diff --git a/utils_linux.go b/utils_linux.go index 336955db1..fe617c711 100644 --- a/utils_linux.go +++ b/utils_linux.go @@ -239,12 +239,12 @@ func (r *runner) run(config *specs.Process) (int, error) { r.destroy() return -1, err } - if err := startFn(process); err != nil { + if err = startFn(process); err != nil { r.destroy() return -1, err } if config.Terminal { - if err := tty.recvtty(process, r.detach || r.create); err != nil { + if err = tty.recvtty(process, r.detach || r.create); err != nil { r.terminate(process) r.destroy() return -1, err @@ -284,13 +284,13 @@ func (r *runner) run(config *specs.Process) (int, error) { } } - if err := tty.ClosePostStart(); err != nil { + if err = tty.ClosePostStart(); err != nil { r.terminate(process) r.destroy() return -1, err } if r.pidFile != "" { - if err := createPidFile(r.pidFile, process); err != nil { + if err = createPidFile(r.pidFile, process); err != nil { r.terminate(process) r.destroy() return -1, err @@ -314,8 +314,8 @@ func (r *runner) destroy() { } func (r *runner) terminate(p *libcontainer.Process) { - p.Signal(syscall.SIGKILL) - p.Wait() + _ = p.Signal(syscall.SIGKILL) + _, _ = p.Wait() } func validateProcessSpec(spec *specs.Process) error {