ef2781d78de72e740e47ae641733164bfec919cd
[busybox-power] / debian / patches / 1.19.0-hotfixes / busybox-1.19.0-cttyhack.patch
1 --- busybox-1.19.0/shell/cttyhack.c
2 +++ busybox-1.19.0-cttyhack/shell/cttyhack.c
3 @@ -122,10 +122,12 @@ int cttyhack_main(int argc UNUSED_PARAM,
4                 do {
5  #ifdef __linux__
6                         int s = open_read_close("/sys/class/tty/console/active",
7 -                               console + 5, sizeof(console) - 5 - 1);
8 +                               console + 5, sizeof(console) - 5);
9                         if (s > 0) {
10 -                               /* found active console via sysfs (Linux 2.6.38+) */
11 -                               console[5 + s] = '\0';
12 +                               /* found active console via sysfs (Linux 2.6.38+)
13 +                                * sysfs string looks like "ttyS0\n" so zap the newline:
14 +                                */
15 +                               console[4 + s] = '\0';
16                                 break;
17                         }
18