diff options
Diffstat (limited to 'miscutils/less.c')
-rw-r--r-- | miscutils/less.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index 79732cc41..a7041552d 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -1251,6 +1251,9 @@ int less_main(int argc, char **argv) | |||
1251 | * is not a tty and turns into cat. This makes sense. */ | 1251 | * is not a tty and turns into cat. This makes sense. */ |
1252 | if (!isatty(STDOUT_FILENO)) | 1252 | if (!isatty(STDOUT_FILENO)) |
1253 | return bb_cat(argv); | 1253 | return bb_cat(argv); |
1254 | kbd_fd = open(CURRENT_TTY, O_RDONLY); | ||
1255 | if (kbd_fd < 0) | ||
1256 | return bb_cat(argv); | ||
1254 | 1257 | ||
1255 | if (!num_files) { | 1258 | if (!num_files) { |
1256 | if (isatty(STDIN_FILENO)) { | 1259 | if (isatty(STDIN_FILENO)) { |
@@ -1261,8 +1264,6 @@ int less_main(int argc, char **argv) | |||
1261 | } else | 1264 | } else |
1262 | filename = xstrdup(files[0]); | 1265 | filename = xstrdup(files[0]); |
1263 | 1266 | ||
1264 | kbd_fd = xopen(CURRENT_TTY, O_RDONLY); | ||
1265 | |||
1266 | get_terminal_width_height(kbd_fd, &width, &max_displayed_line); | 1267 | get_terminal_width_height(kbd_fd, &width, &max_displayed_line); |
1267 | /* 20: two tabstops + 4 */ | 1268 | /* 20: two tabstops + 4 */ |
1268 | if (width < 20 || max_displayed_line < 3) | 1269 | if (width < 20 || max_displayed_line < 3) |