diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-23 12:12:03 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-23 12:12:03 +0000 |
commit | b0f54743e36af163ae2530c381c485bb29df13dc (patch) | |
tree | cda4cfeaae6e47fe4f14c1b566092be4da9affc4 /shell/cttyhack.c | |
parent | 40514a0309939f2446f0d4ed9600cad5de396e7f (diff) | |
parent | ba88826c66411affc1da3614742b454654f7298a (diff) | |
download | busybox-w32-b0f54743e36af163ae2530c381c485bb29df13dc.tar.gz busybox-w32-b0f54743e36af163ae2530c381c485bb29df13dc.tar.bz2 busybox-w32-b0f54743e36af163ae2530c381c485bb29df13dc.zip |
Merge branch 'busybox' into merge
Conflicts:
Makefile.flags
Diffstat (limited to 'shell/cttyhack.c')
-rw-r--r-- | shell/cttyhack.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/shell/cttyhack.c b/shell/cttyhack.c index 6ff867413..f9b59c263 100644 --- a/shell/cttyhack.c +++ b/shell/cttyhack.c | |||
@@ -123,15 +123,22 @@ int cttyhack_main(int argc UNUSED_PARAM, char **argv) | |||
123 | * TIOCGSERIAL check, which assumes that all | 123 | * TIOCGSERIAL check, which assumes that all |
124 | * serial lines follow /dev/ttySn convention - | 124 | * serial lines follow /dev/ttySn convention - |
125 | * which is not always the case. | 125 | * which is not always the case. |
126 | * Therefore, we use this methos first: | 126 | * Therefore, we use this method first: |
127 | */ | 127 | */ |
128 | int s = open_read_close("/sys/class/tty/console/active", | 128 | int s = open_read_close("/sys/class/tty/console/active", |
129 | console + 5, sizeof(console) - 5); | 129 | console + 5, sizeof(console) - 5); |
130 | if (s > 0) { | 130 | if (s > 0) { |
131 | /* found active console via sysfs (Linux 2.6.38+) | 131 | char *last; |
132 | * sysfs string looks like "ttyS0\n" so zap the newline: | 132 | /* Found active console via sysfs (Linux 2.6.38+). |
133 | * It looks like "[tty0 ]ttyS0\n" so zap the newline: | ||
133 | */ | 134 | */ |
134 | console[4 + s] = '\0'; | 135 | console[4 + s] = '\0'; |
136 | /* If there are multiple consoles, | ||
137 | * take the last one: | ||
138 | */ | ||
139 | last = strrchr(console + 5, ' '); | ||
140 | if (last) | ||
141 | overlapping_strcpy(console + 5, last + 1); | ||
135 | break; | 142 | break; |
136 | } | 143 | } |
137 | 144 | ||