diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-03-23 23:15:36 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-03-23 23:15:36 +0000 |
commit | 13b9522e731f023a34c232c6857d488d983de1e3 (patch) | |
tree | be9b3406b9b0598d0bc42d6912a7855f7ee11819 /libbb | |
parent | e8673e9ded6d118d96bec43c7376d26f90857cae (diff) | |
download | busybox-w32-13b9522e731f023a34c232c6857d488d983de1e3.tar.gz busybox-w32-13b9522e731f023a34c232c6857d488d983de1e3.tar.bz2 busybox-w32-13b9522e731f023a34c232c6857d488d983de1e3.zip |
Brian Pomerantz writes:
I've noticed a bug in the "autowidth" feature more, and is probably in
others. The call to the function get_terminal_width_height() passes
in a file descriptor but that file descriptor is never used, instead
the ioctl() is called with 0. In more_main() the call to
get_terminal_width_height() passes 0 as the file descriptor instead of
fileno(cin). This isn't a problem when you more a file (e.g. "more
/etc/passwd") but when you pipe a file to it (e.g. "cat /etc/passwd |
more") the size of the terminal cannot be determined because file
descriptor 0 is not a terminal. The fix is simple, I've attached a
patch for more.c and get_terminal_width_height.c.
BAPper
git-svn-id: svn://busybox.net/trunk/busybox@8656 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/get_terminal_width_height.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libbb/get_terminal_width_height.c b/libbb/get_terminal_width_height.c index ef90463fb..7a1af6dc1 100644 --- a/libbb/get_terminal_width_height.c +++ b/libbb/get_terminal_width_height.c | |||
@@ -36,7 +36,7 @@ void get_terminal_width_height(int fd, int *width, int *height) | |||
36 | { | 36 | { |
37 | struct winsize win = { 0, 0, 0, 0 }; | 37 | struct winsize win = { 0, 0, 0, 0 }; |
38 | #ifdef CONFIG_FEATURE_AUTOWIDTH | 38 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
39 | if (ioctl(0, TIOCGWINSZ, &win) != 0) { | 39 | if (ioctl(fd, TIOCGWINSZ, &win) != 0) { |
40 | win.ws_row = 24; | 40 | win.ws_row = 24; |
41 | win.ws_col = 80; | 41 | win.ws_col = 80; |
42 | } | 42 | } |