From 178e126a07d275105c5cf433bab165cdd8c66cff Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 12 Feb 2013 09:10:47 -0800 Subject: [PATCH] Fixed a bug which caused dockerd to crash when it received a call without arguments --- rcli/types.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rcli/types.go b/rcli/types.go index 10a2938f37..b8572cd896 100644 --- a/rcli/types.go +++ b/rcli/types.go @@ -27,6 +27,9 @@ type CmdMethod func(Service, io.ReadCloser, io.Writer, ...string) error func call(service Service, stdin io.ReadCloser, stdout io.Writer, args ...string) error { + if len(args) == 0 { + args = []string{"help"} + } flags := flag.NewFlagSet("main", flag.ContinueOnError) flags.SetOutput(stdout) flags.Usage = func() { stdout.Write([]byte(service.Help())) } @@ -40,7 +43,7 @@ func call(service Service, stdin io.ReadCloser, stdout io.Writer, args ...string } method := getMethod(service, cmd) if method != nil { - return method(stdin, stdout, args[1:]...) + return method(stdin, stdout, flags.Args()[1:]...) } return errors.New("No such command: " + cmd) }