On Mon, Oct 31, 2011 at 12:25 PM, Denys Vlasenko
<[email protected]> wrote:
> On Mon, Oct 31, 2011 at 1:15 AM, Alexander Shishkin <[email protected]> 
> wrote:
>> Sometimes there's a need to figure out the controlling tty from a shell
>> script, for example, to obtain a line for getty.
>> In this case it's easier
>> to call cttyhack than trying to repeat some of the cttyhack's logic.
>
> "cttyhack getty 0 -" should work, right?
>
>
>> +       /* If it's a /dev/tty, still make sure it's wired to std{in,out,err} 
>> */
>> +       fd = open_or_warn(console, O_RDWR);
>> +       if (fd < 0)
>> +               goto ret;
>> +       //bb_error_msg("switching to '%s'", console);
>> +       dup2(fd, STDIN_FILENO);
>> +       dup2(fd, STDOUT_FILENO);
>> +       xmove_fd(fd, STDERR_FILENO);
>
> Think what would happen if fd = 1

Fixed it and applied to git. Thanks.
-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to