Signed-off-by: Ferenc Wagner <wf...@niif.hu>
---
 src/lxc/start.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index b69ac88..851d383 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -463,6 +463,7 @@ int lxc_spawn(struct lxc_handler *handler)
        int clone_flags;
        int failed_before_rename = 0;
        const char *name = handler->name;
+       int ctty;
 
        if (lxc_sync_init(handler))
                return -1;
@@ -509,6 +510,22 @@ int lxc_spawn(struct lxc_handler *handler)
                }
        }
 
+       if (setpgid(handler->pid, 0)) {
+               SYSERROR("failed to create new process group");
+               goto out_delete_net;
+       }
+       DEBUG("created new process group %d", handler->pid);
+       ctty = open("/dev/tty", O_RDONLY);
+       if (ctty) {
+               int ret = tcsetpgrp(ctty, handler->pid);
+               close(ctty);
+               if (ret) {
+                       SYSERROR("failed to set terminal foreground process 
group");
+                       goto out_delete_net;
+               }
+               DEBUG("set terminal foreground process group");
+       }
+       
        /* Tell the child to continue its initialization and wait for
         * it to exec or return an error
         */
-- 
1.6.5


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to