diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-05 18:29:57 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-05 18:29:57 +0000 |
commit | 2c205b2b7f5864784433bf4db3787be5c9e89082 (patch) | |
tree | c353490afe881de58244eec47162d972cce30018 /net | |
parent | a79d5f4cbfd3fc1ff5013932cdd63d4d7baa1306 (diff) | |
download | chromium_src-2c205b2b7f5864784433bf4db3787be5c9e89082.zip chromium_src-2c205b2b7f5864784433bf4db3787be5c9e89082.tar.gz chromium_src-2c205b2b7f5864784433bf4db3787be5c9e89082.tar.bz2 |
Coverity: Assert that socket() returns a successful value.
CID=6383
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/256055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28011 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/listen_socket_unittest.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/base/listen_socket_unittest.cc b/net/base/listen_socket_unittest.cc index 584d086..eb224c3 100644 --- a/net/base/listen_socket_unittest.cc +++ b/net/base/listen_socket_unittest.cc @@ -33,7 +33,7 @@ void ListenSocketTester::SetUp() { server_ = NULL; net::EnsureWinsockInit(); #elif defined(OS_POSIX) - ASSERT_EQ(0, pthread_mutex_init(&lock_, NULL )); + ASSERT_EQ(0, pthread_mutex_init(&lock_, NULL)); sem_unlink(kSemaphoreName); semaphore_ = sem_open(kSemaphoreName, O_CREAT, 0, 0); ASSERT_NE(SEM_FAILED, semaphore_); @@ -42,7 +42,7 @@ void ListenSocketTester::SetUp() { options.message_loop_type = MessageLoop::TYPE_IO; thread_.reset(new base::Thread("socketio_test")); thread_->StartWithOptions(options); - loop_ = (MessageLoopForIO*)thread_->message_loop(); + loop_ = reinterpret_cast<MessageLoopForIO*>(thread_->message_loop()); loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &ListenSocketTester::Listen)); @@ -54,6 +54,7 @@ void ListenSocketTester::SetUp() { // verify the connect/accept and setup test_socket_ test_socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + ASSERT_NE(-1, test_socket_); struct sockaddr_in client; client.sin_family = AF_INET; client.sin_addr.s_addr = inet_addr(kLoopback); @@ -132,7 +133,7 @@ bool ListenSocketTester::NextAction(int timeout) { return false; while (true) { int result = sem_trywait(semaphore_); - PlatformThread::Sleep(1); // 1MS sleep + PlatformThread::Sleep(1); // 1MS sleep timeout--; if (timeout <= 0) return false; |