summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Oleynik (GitHub) <aoleynik@luxoft.com>2017-12-07 21:11:12 +0200
committerAndriy Byzhynar <AByzhynar@luxoft.com>2018-01-18 12:03:51 +0200
commitff03d26be902584fc81a6c1701f57489c86f8ccf (patch)
treec5e6ed79dfa85ba940a0b57fbc86683df8530b59
parent41c7c86289c1c36252ce217041e13214b080fe82 (diff)
downloadsdl_core-ff03d26be902584fc81a6c1701f57489c86f8ccf.tar.gz
Adds error handling
-rw-r--r--src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc
index 01ecb6e43c..66b4ad2901 100644
--- a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc
+++ b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc
@@ -131,12 +131,15 @@ void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::threadMain() {
const auto size = 32;
while (run_flag_) {
- char buffer[size];
- // TODO: maybe need to check errno
+ char buffer[size];
auto bytes = read(in_, &buffer, size);
- if (!bytes) {
+ if (0 == bytes) {
continue;
}
+ if (-1 == bytes) {
+ LOG4CXX_DEBUG(logger_, "Error during input pipe read");
+ break;
+ }
LOG4CXX_DEBUG(logger_, "Read in bytes: " << bytes);
std::string str(buffer);
if (std::string::npos != str.find(switch_signal)) {