diff options
author | Nathan Binkert <nate@binkert.org> | 2008-09-19 09:11:42 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2008-09-19 09:11:42 -0700 |
commit | ea83cedcf625c35ddc6fe6b9390cdd1cca6b2039 (patch) | |
tree | 083da1af8d314dcb20a8d2f76c088247e5416bbf /src/dev/ethertap.cc | |
parent | f066db7fcd49d2234178e5d80db9278c798d9ba8 (diff) | |
download | gem5-ea83cedcf625c35ddc6fe6b9390cdd1cca6b2039.tar.xz |
Check the return value of I/O operations for failure
Diffstat (limited to 'src/dev/ethertap.cc')
-rw-r--r-- | src/dev/ethertap.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dev/ethertap.cc b/src/dev/ethertap.cc index c7b292c8a..f1fd1800b 100644 --- a/src/dev/ethertap.cc +++ b/src/dev/ethertap.cc @@ -182,8 +182,12 @@ EtherTap::recvPacket(EthPacketPtr packet) DPRINTF(Ethernet, "EtherTap output len=%d\n", packet->length); DDUMP(EthernetData, packet->data, packet->length); uint32_t len = htonl(packet->length); - write(socket, &len, sizeof(len)); - write(socket, packet->data, packet->length); + ssize_t ret = write(socket, &len, sizeof(len)); + if (ret != sizeof(len)) + return false; + ret = write(socket, packet->data, packet->length); + if (ret != packet->length) + return false; interface->recvDone(); |