From: Andrey Goder Date: Mon, 28 Apr 2014 20:43:17 +0000 (-0700) Subject: Use readNoInt/writeNoInt in folly::Subprocess X-Git-Tag: v0.22.0~576 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b8ec9e5040170e4b7d044f971c772cbed3a6883e;p=folly.git Use readNoInt/writeNoInt in folly::Subprocess Summary: We have these helper methods, but are not using them. What sadness. Test Plan: fbconfig -r folly fbmake runtests Reviewed By: tudorb@fb.com FB internal diff: D1299720 --- diff --git a/folly/Subprocess.cpp b/folly/Subprocess.cpp index ac1fc8e4..63a336a5 100644 --- a/folly/Subprocess.cpp +++ b/folly/Subprocess.cpp @@ -576,10 +576,7 @@ bool handleWrite(int fd, IOBufQueue& queue) { return true; // EOF } - ssize_t n; - do { - n = ::write(fd, p.first, p.second); - } while (n == -1 && errno == EINTR); + ssize_t n = writeNoInt(fd, p.first, p.second); if (n == -1 && errno == EAGAIN) { return false; } @@ -592,10 +589,7 @@ bool handleWrite(int fd, IOBufQueue& queue) { bool handleRead(int fd, IOBufQueue& queue) { for (;;) { auto p = queue.preallocate(100, 65000); - ssize_t n; - do { - n = ::read(fd, p.first, p.second); - } while (n == -1 && errno == EINTR); + ssize_t n = readNoInt(fd, p.first, p.second); if (n == -1 && errno == EAGAIN) { return false; } @@ -613,10 +607,7 @@ bool discardRead(int fd) { static std::unique_ptr buf(new char[bufSize]); for (;;) { - ssize_t n; - do { - n = ::read(fd, buf.get(), bufSize); - } while (n == -1 && errno == EINTR); + ssize_t n = readNoInt(fd, buf.get(), bufSize); if (n == -1 && errno == EAGAIN) { return false; }