[CRIU] [PATCH 4/5] tty: require stdin to be a terminal only if shell_job is set
Andrey Vagin
avagin at openvz.org
Fri Jan 18 06:05:19 EST 2013
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
cr-restore.c | 6 +++---
include/tty.h | 2 +-
tty.c | 5 ++++-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/cr-restore.c b/cr-restore.c
index a7027ff..0f5b488 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -89,7 +89,7 @@ static int shmem_remap(void *old_addr, void *new_addr, unsigned long size)
return 0;
}
-static int crtools_prepare_shared(void)
+static int crtools_prepare_shared(struct cr_options *opts)
{
if (prepare_shared_fdinfo())
return -1;
@@ -98,7 +98,7 @@ static int crtools_prepare_shared(void)
if (collect_inet_sockets())
return -1;
- if (tty_prep_fds())
+ if (tty_prep_fds(opts))
return -1;
return 0;
@@ -1261,7 +1261,7 @@ int cr_restore_tasks(pid_t pid, struct cr_options *opts)
if (prepare_pstree() < 0)
return -1;
- if (crtools_prepare_shared() < 0)
+ if (crtools_prepare_shared(opts) < 0)
return -1;
return restore_root_task(root_item, opts);
diff --git a/include/tty.h b/include/tty.h
index e7e653a..905e204 100644
--- a/include/tty.h
+++ b/include/tty.h
@@ -21,7 +21,7 @@ extern int tty_setup_slavery(void);
extern int tty_verify_active_pairs(void);
-extern int tty_prep_fds(void);
+extern int tty_prep_fds(struct cr_options *opts);
extern void tty_fini_fds(void);
#endif /* __CR_TTY_H__ */
diff --git a/tty.c b/tty.c
index 5a78a0f..251930b 100644
--- a/tty.c
+++ b/tty.c
@@ -1193,8 +1193,11 @@ int dump_tty(struct fd_parms *p, int lfd, const int fdinfo)
return do_dump_gen_file(p, lfd, &tty_ops, fdinfo);
}
-int tty_prep_fds(void)
+int tty_prep_fds(struct cr_options *opts)
{
+ if (!opts->shell_job)
+ return 0;
+
if (!isatty(STDIN_FILENO)) {
pr_err("Standart stream is not a terminal, aborting\n");
return -1;
--
1.7.11.7
More information about the CRIU
mailing list