From fcc40b7a63fd23bebd2bf6fdf3f2aed8dbbf5b83 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 17 Oct 2016 15:54:51 -0700 Subject: [PATCH] Remove panic from init Print the error message to stderr if we are unable to return it back via the pipe to the parent process. Also, don't panic here as it is most likely a system or user error and not a programmer error. Signed-off-by: Michael Crosby --- libcontainer/factory_linux.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libcontainer/factory_linux.go b/libcontainer/factory_linux.go index cc336c14..6e2bf3ad 100644 --- a/libcontainer/factory_linux.go +++ b/libcontainer/factory_linux.go @@ -256,11 +256,13 @@ func (l *LinuxFactory) StartInitialization() (err error) { if _, ok := i.(*linuxStandardInit); ok { // Synchronisation only necessary for standard init. if werr := utils.WriteJSON(pipe, syncT{procError}); werr != nil { - panic(err) + fmt.Fprintln(os.Stderr, err) + return } } if werr := utils.WriteJSON(pipe, newSystemError(err)); werr != nil { - panic(err) + fmt.Fprintln(os.Stderr, err) + return } // ensure that this pipe is always closed pipe.Close()