mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #1257 from mrunalp/fix_warnings
Simplify error handling on function return
This commit is contained in:
@@ -178,9 +178,8 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
|
||||
p.Capabilities = caps
|
||||
}
|
||||
// append the passed env variables
|
||||
for _, e := range context.StringSlice("env") {
|
||||
p.Env = append(p.Env, e)
|
||||
}
|
||||
p.Env = append(p.Env, context.StringSlice("env")...)
|
||||
|
||||
// set the tty
|
||||
if context.IsSet("tty") {
|
||||
p.Terminal = context.Bool("tty")
|
||||
|
||||
@@ -39,10 +39,7 @@ var psCommand = cli.Command{
|
||||
}
|
||||
|
||||
if context.String("format") == "json" {
|
||||
if err := json.NewEncoder(os.Stdout).Encode(pids); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return json.NewEncoder(os.Stdout).Encode(pids)
|
||||
}
|
||||
|
||||
// [1:] is to remove command name, ex:
|
||||
|
||||
@@ -108,10 +108,7 @@ func (t *tty) sendtty(socket *os.File, ti *libcontainer.TerminalInfo) error {
|
||||
|
||||
// Create a fake file to contain the terminal info.
|
||||
console := os.NewFile(t.console.File().Fd(), ti.String())
|
||||
if err := utils.SendFd(socket, console); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return utils.SendFd(socket, console)
|
||||
}
|
||||
|
||||
// ClosePostStart closes any fds that are provided to the container and dup2'd
|
||||
|
||||
@@ -224,9 +224,6 @@ other options are ignored.
|
||||
config.Cgroups.Resources.MemoryReservation = int64(*r.Memory.Reservation)
|
||||
config.Cgroups.Resources.MemorySwap = int64(*r.Memory.Swap)
|
||||
|
||||
if err := container.Set(config); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return container.Set(config)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user