diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-05-10 18:43:17 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-05-10 18:43:17 +1000 |
commit | 4e979dee506fdcf43684b55ecc52b9a2fd1dd2c1 (patch) | |
tree | 623f28f562a7495cd8ebfdf73ccd053468e52dea | |
parent | f4e6f8d4a90571e6b9730541e37e43d353442426 (diff) | |
download | busybox-w32-4e979dee506fdcf43684b55ecc52b9a2fd1dd2c1.tar.gz busybox-w32-4e979dee506fdcf43684b55ecc52b9a2fd1dd2c1.tar.bz2 busybox-w32-4e979dee506fdcf43684b55ecc52b9a2fd1dd2c1.zip |
get_wincon_width_height(): do not return uninitialized value if GetConsoleScreenBufferInfo() fails
-rw-r--r-- | libbb/termios.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libbb/termios.c b/libbb/termios.c index 5695e9ba2..c05bb6dbb 100644 --- a/libbb/termios.c +++ b/libbb/termios.c | |||
@@ -226,11 +226,9 @@ static int get_wincon_width_height(const int fd, int *width, int *height) | |||
226 | CONSOLE_SCREEN_BUFFER_INFO sbi; | 226 | CONSOLE_SCREEN_BUFFER_INFO sbi; |
227 | 227 | ||
228 | console = GetStdHandle(STD_OUTPUT_HANDLE); | 228 | console = GetStdHandle(STD_OUTPUT_HANDLE); |
229 | if (console == INVALID_HANDLE_VALUE || !console) | 229 | if (console == INVALID_HANDLE_VALUE || !console || !GetConsoleScreenBufferInfo(console, &sbi)) |
230 | return -1; | 230 | return -1; |
231 | 231 | ||
232 | GetConsoleScreenBufferInfo(console, &sbi); | ||
233 | |||
234 | if (width) | 232 | if (width) |
235 | *width = sbi.srWindow.Right - sbi.srWindow.Left; | 233 | *width = sbi.srWindow.Right - sbi.srWindow.Left; |
236 | if (height) | 234 | if (height) |