X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=support%2Fsdk%2Fcpp%2Fsf%2Fbasecomm.cpp;h=788349d6af8a2c8a69f3998c5cba806473fcc8b4;hb=f2ec0361a8796350bde71e0611e16be06ba22be0;hp=bad3e50f3c5b93d4e97a85f06affbc47cae13946;hpb=ab3fe89b185c317159f4d206b9e51f50d494bec5;p=tinyos-2.x.git diff --git a/support/sdk/cpp/sf/basecomm.cpp b/support/sdk/cpp/sf/basecomm.cpp index bad3e50f..788349d6 100644 --- a/support/sdk/cpp/sf/basecomm.cpp +++ b/support/sdk/cpp/sf/basecomm.cpp @@ -46,7 +46,7 @@ BaseComm::~BaseComm() } /* all count bytes must be read before returning - blocking in that way... */ -int BaseComm::readFD(int fd, char *buffer, int count) +int BaseComm::readFD(int fd, char *buffer, int count, int *err) { int actual = 0; while (count > 0) @@ -54,6 +54,7 @@ int BaseComm::readFD(int fd, char *buffer, int count) int n = read(fd, buffer, count); if (n == -1) { + *err = errno; return -1; } if (n == 0) @@ -68,7 +69,7 @@ int BaseComm::readFD(int fd, char *buffer, int count) } /* all count bytes must be written before returning - blocking in that way... */ -int BaseComm::writeFD(int fd, const char *buffer, int count) +int BaseComm::writeFD(int fd, const char *buffer, int count, int *err) { int actual = 0; while (count > 0) @@ -77,6 +78,7 @@ int BaseComm::writeFD(int fd, const char *buffer, int count) if(n == -1) { if(errno != 0) { + *err = errno; return -1; } else {