diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 02:55:12 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 02:55:12 +0000 |
commit | 9010d7f273b645f81e707b45081c0ab437c54377 (patch) | |
tree | 1296fc8cf3930691941a4d39e48dbf2ee6f1f5d1 /net/base | |
parent | bc5a77fdce2b4a183aa011629b80d693da5a1551 (diff) | |
download | chromium_src-9010d7f273b645f81e707b45081c0ab437c54377.zip chromium_src-9010d7f273b645f81e707b45081c0ab437c54377.tar.gz chromium_src-9010d7f273b645f81e707b45081c0ab437c54377.tar.bz2 |
Net unittests: handle the case where recv fails
(found by Coverity)
Review URL: http://codereview.chromium.org/48164
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/listen_socket_unittest.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/base/listen_socket_unittest.cc b/net/base/listen_socket_unittest.cc index fc95e92..96b169c 100644 --- a/net/base/listen_socket_unittest.cc +++ b/net/base/listen_socket_unittest.cc @@ -269,7 +269,15 @@ void ListenSocketTester::TestServerSend() { PlatformThread::Sleep(10); // sleep for 10ms const int buf_len = 200; char buf[buf_len+1]; - int recv_len = recv(test_socket_, buf, buf_len, 0); + int recv_len; + do { + recv_len = recv(test_socket_, buf, buf_len, 0); +#if defined(OS_POSIX) + } while (recv_len == SOCKET_ERROR && errno == EINTR); +#else + } while (false); +#endif + ASSERT_NE(recv_len, SOCKET_ERROR); buf[recv_len] = 0; ASSERT_STREQ(buf, kHelloWorld); } |