[1.20.0] getty: setsid: Operation not permitted (dissected)

Denys Vlasenko vda.linux at googlemail.com
Thu Apr 26 08:55:54 UTC 2012


On Wed, Apr 25, 2012 at 9:20 PM, Tomasz Czapiewski <xeros at irc.pl> wrote:
> On Tue, 24 Apr 2012, Denys Vlasenko wrote:
>
>> On Tue, Apr 24, 2012 at 9:55 PM, Tomasz Czapiewski <xeros at irc.pl> wrote:
>>>>
>>>> Let's verify that.
>>>> Can you add a debugging printout in getty_main() here?
>>>>
>>>>       /* Create new session and pgrp, lose controlling tty */
>>>> bb_error_msg("pid:%d", getpid());
>>>> bb_error_msg("sid:%d", getsid(0));
>>>>       pid = setsid();  /* this also gives us our pid :) */
>>>>       if (pid < 0) {
>>>> ...
>>>>
>>>> run it and tell me what do you observe?
>>>
>>>
>>
>> Thanks. I need more data. Can you add these printouts?
>>
>>               fd = open("/dev/tty", O_RDWR | O_NONBLOCK);
>> bb_error_msg("dev tty fd:%d", fd);
>>               if (fd >= 0) {
>> bb_error_msg("doing NOTTY");
>>                       ioctl(fd, TIOCNOTTY);
>> bb_error_msg("done NOTTY");
>>                       close(fd);
>>               }
>> bb_error_msg("end of if");
>>       }
>>
>
> starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
> getty: pid:851
> getty: sid:851
> getty: dev tty fd:3
> getty: doing NOTTY
>
> starting pid 1, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt102'
> process '/sbin/getty -L ttyS0 115200 vt102' (pid 851) exited. Scheduling for
> restart.

Thanks. I think I know what's the problem. Try this patch:

http://busybox.net/downloads/fixes-1.20.0/busybox-1.20.0-getty.patch

-- 
vda


More information about the busybox mailing list