[PATCH] ash: setsid and TIOCSCTTY when enabling job control.
Avery Pennarun
apenwarr at gmail.com
Tue Mar 13 03:27:28 UTC 2012
On Mon, Mar 12, 2012 at 11:16 PM, Denys Vlasenko
<vda.linux at googlemail.com> wrote:
>> This makes busybox sh job control usable with "init=/bin/sh" on the Linux
>> kernel command line.
>
> I don't think so. In this case, stdio is redirected to /dev/console.
> In Linux, /dev/console can't be a controlling terminal.
I tested it, it works. Linux (at least modern kernels) seem to just
set your controlling console to whatever /dev/console is pointing at,
which is exactly what you want.
>> /* fd is a tty at this point */
>> + setsid();
>
> Creating new session for every interactive shell?
> I have a feeling this is breaking a lot of things.
Would you prefer if we called tcgetsid() first?
>> + ioctl(fd, TIOCSCTTY, 0);
>
> This *might* be ok....
It should be fine; it only steals the controlling terminal from anyone
else if arg3 == 1.
Have fun,
Avery
More information about the busybox
mailing list