Browse Source

Check return of read() and write() to prevent g++ warning

Paul-Louis Ageneau 4 years ago
parent
commit
f61ca226fb
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/impl/tcptransport.cpp

+ 6 - 2
src/impl/tcptransport.cpp

@@ -64,7 +64,9 @@ int SelectInterrupter::prepare(fd_set &readfds, [[maybe_unused]] fd_set &writefd
 	return SOCKET_TO_INT(mDummySock) + 1;
 	return SOCKET_TO_INT(mDummySock) + 1;
 #else
 #else
 	char dummy;
 	char dummy;
-	(void)::read(mPipeIn, &dummy, 1);
+	if (::read(mPipeIn, &dummy, 1) < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
+		PLOG_WARNING << "Reading from interrupter pipe failed, errno=" << errno;
+	}
 	FD_SET(mPipeIn, &readfds);
 	FD_SET(mPipeIn, &readfds);
 	return mPipeIn + 1;
 	return mPipeIn + 1;
 #endif
 #endif
@@ -79,7 +81,9 @@ void SelectInterrupter::interrupt() {
 	}
 	}
 #else
 #else
 	char dummy = 0;
 	char dummy = 0;
-	(void)::write(mPipeOut, &dummy, 1);
+	if (::write(mPipeOut, &dummy, 1) < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
+		PLOG_WARNING << "Writing to interrupter pipe failed, errno=" << errno;
+	}
 #endif
 #endif
 }
 }