Adding handling for ioctl failure. Updates from code review in PR #1615.
This commit is contained in:
parent
c0876672fa
commit
1da44b346c
|
@ -13,6 +13,7 @@
|
|||
#include <boost/thread/synchronized_value.hpp>
|
||||
#include <string>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
AtomicCounter transactionsValidated;
|
||||
AtomicCounter ehSolverRuns;
|
||||
|
@ -197,8 +198,8 @@ void ThreadShowMetricsScreen()
|
|||
// Get current window size
|
||||
if (isatty(STDOUT_FILENO)) {
|
||||
struct winsize w;
|
||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||
if (w.ws_col) {
|
||||
w.ws_col = 0;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
||||
cols = w.ws_col;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue