On Fri, Oct 04, 2002 at 08:39:17AM -0700, Matt Kraai wrote:
> The `Execute a shell' option is broken because BusyBox init does
> not give controlling terminals to respawn actions.  Erik, what
> would you suggest?

The following patch makes it work.

Matt
-- 
Freedom is not free.

--- busybox-0.60.4/init.c       2002-09-15 23:55:12.000000000 -0700
+++ busybox/init.c      2002-10-04 09:17:54.000000000 -0700
@@ -491,12 +491,11 @@
                signal(SIGTSTP, SIG_DFL);
 
                /* Create a new session and make ourself the process
-                * group leader for non-interactive jobs */
-               if ((a->action & (RESPAWN))==0)
-                       setsid();
+                * group leader */
+               setsid();
 
                /* Open the new terminal device */
-               if ((device_open(a->terminal, O_RDWR|O_NOCTTY)) < 0) {
+               if ((device_open(a->terminal, O_RDWR)) < 0) {
                        if (stat(a->terminal, &sb) != 0) {
                                message(LOG | CONSOLE, "\rdevice '%s' does not 
exist.\n",
                                                a->terminal);
@@ -506,10 +505,6 @@
                        _exit(1);
                }
 
-               /* Non-interactive jobs should not get a controling tty */
-               if ((a->action & (RESPAWN))==0)
-                       (void)ioctl(0, TIOCSCTTY, 0);
-
                /* Make sure the terminal will act fairly normal for us */
                set_term(0);
                /* Setup stdout, stderr for the new process so
@@ -517,11 +512,6 @@
                dup(0);
                dup(0);
 
-               /* For interactive jobs, create a new session 
-                * and become the process group leader */
-               if ((a->action & (RESPAWN)))
-                       setsid();
-
                /* If the init Action requires us to wait, then force the
                 * supplied terminal to be the controlling tty. */
                if (a->action & (SYSINIT|WAIT|CTRLALTDEL|SHUTDOWN|RESTART)) {


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to