From 1c92c0ecbf02e06304c2882f89de74c183ce63fc Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Tue, 29 Aug 2017 09:45:06 -0700 Subject: [PATCH] Fix panic in CloseIO when not Stdin was allocated for a process Signed-off-by: Kenfe-Mickael Laventure --- linux/shim/service.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linux/shim/service.go b/linux/shim/service.go index 76f502f4a..41f1fdffa 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -330,8 +330,10 @@ func (s *Service) CloseIO(ctx context.Context, r *shimapi.CloseIORequest) (*goog if !ok { return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "process does not exist %s", r.ID) } - if err := p.Stdin().Close(); err != nil { - return nil, err + if stdin := p.Stdin(); stdin != nil { + if err := stdin.Close(); err != nil { + return nil, errors.Wrap(err, "close stdin") + } } return empty, nil }