Permalink
Browse files

Fix error shadow and error check warnings

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
  • Loading branch information...
1 parent 1a9dd26 commit c54f1495e3d9202daf3ff3d88faa8c906e616873 @mrunalp mrunalp committed Jan 7, 2017
Showing with 11 additions and 11 deletions.
  1. +2 −2 delete.go
  2. +3 −3 restore.go
  3. +6 −6 utils_linux.go
View
@@ -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)
View
@@ -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
}
}
View
@@ -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 {

0 comments on commit c54f149

Please sign in to comment.