Adding handling for ioctl failure. Updates from code review in PR #1615.

This commit is contained in:
Joe Turgeon 2016-10-23 21:23:56 -05:00
parent c0876672fa
commit 1da44b346c
No known key found for this signature in database
GPG Key ID: 7B63B97D65DC695F
1 changed files with 6 additions and 5 deletions

View File

@ -13,6 +13,7 @@
#include <boost/thread/synchronized_value.hpp>
#include <string>
#include <sys/ioctl.h>
#include <unistd.h>
AtomicCounter transactionsValidated;
AtomicCounter ehSolverRuns;
@ -196,11 +197,11 @@ void ThreadShowMetricsScreen()
// Get current window size
if (isatty(STDOUT_FILENO)) {
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
if (w.ws_col) {
cols = w.ws_col;
}
struct winsize w;
w.ws_col = 0;
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
cols = w.ws_col;
}
}
// Erase below current position