[1.16.2] Can't stop "ping" with CTRL+c

Kevin Cernekee cernekee at gmail.com
Wed Jul 13 17:29:50 UTC 2011


On Wed, Jul 13, 2011 at 8:10 AM, Kevin Cernekee <cernekee at gmail.com> wrote:
> On Wed, Jul 13, 2011 at 12:31 AM, Denys Vlasenko
> <vda.linux at googlemail.com> wrote:
>> +                       ssize_t s = open_read_close("/sys/class/tty/console/active",
>> +                               &console[5], sizeof(console) - 5);
>> +                       if (s > 0) {
>> +                               /* found active console via sysfs (Linux 2.6.38+ only) */
>> +                               console[4 + s] = 0;
>>
>> Why 4, not 5? And if changed to 5, it can overflow console[],
>> need to use sizeof(console) - 6 in read.
>
> The last character read from sysfs is a newline, which needs to be
> removed in order to have a valid pathname.

Attaching fix + improved comment.  This applies against the head of tree.

The current busybox head of tree will not be able to open the device
because it leaves the newline intact:

starting pid 479, tty '': '/bin/cttyhack /bin/sh -l'
cttyhack: can't open '/dev/ttyS0
': No such file or directory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cttyhack-remove-the-trailing-newline-when-reading-co.patch
Type: text/x-patch
Size: 1045 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20110713/e1a96d1d/attachment.bin>


More information about the busybox mailing list