Permalink
Browse files

Use error state for read / write and print out the message

  • Loading branch information...
1 parent 37cd66c commit 23fd0d988f3a777eac9be9ac27699665b927db6c @dbussink dbussink committed Jun 3, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 vm/agent.cpp
View
@@ -195,7 +195,9 @@ namespace rubinius {
void QueryAgent::wakeup() {
char buf = '!';
- write(write_control(), &buf, 1);
+ if(write(write_control(), &buf, 1) < 0) {
+ std::cerr << "[QA: Write error: " << strerror(errno) << "]\n";
+ }
}
void QueryAgent::perform() {
@@ -220,7 +222,9 @@ namespace rubinius {
// Read the one byte written though so we don't clog up the
// pipe and have to use the ponies later.
char buf;
- read(read_control(), &buf, 1);
+ if(read(read_control(), &buf, 1) < 0) {
+ std::cerr << "[QA: Read error: " << strerror(errno) << "]\n";
+ }
} else if(server_fd_ > 0 && FD_ISSET(server_fd_, &read_fds)) {
// now accept an incoming connection
struct sockaddr_in sin;

0 comments on commit 23fd0d9

Please sign in to comment.