From 88f445ce34be2f9c760f5130cc47b5560b276a78 Mon Sep 17 00:00:00 2001 From: Gao feng Date: Sat, 15 Oct 2016 12:28:34 +0800 Subject: [PATCH] don't accept any input if stdin is closed by process fix the input after close problem, this will cause hyperstart panic. Signed-off-by: Gao feng --- src/init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/init.c b/src/init.c index f366d3a..0396735 100644 --- a/src/init.c +++ b/src/init.c @@ -930,8 +930,9 @@ static int hyper_ttyfd_handle(struct hyper_event *de, uint32_t len) fprintf(stdout, "find exec %s pid %d, seq is %" PRIu64 "\n", exec->container_id ? exec->container_id : "pod", exec->pid, exec->seq); - // if exec is exited, the event fd of exec is invalid. don't accept any input. - if (exec->exit || exec->close_stdin_request) { + // if exec is exited or stdin is closed by process, the event fd of exec is invalid. + // don't accept any input. + if (exec->exit || exec->close_stdin_request || exec->stdinev.fd < 0) { fprintf(stdout, "exec seq %" PRIu64 " exited, don't accept any input\n", exec->seq); return 0; }