Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Unified Diff: net/udp/udp_socket_libevent.cc

Issue 1025533002: PCHECK when closing UDP sockets only when errno=EBADF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/udp/udp_socket_libevent.cc
diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc
index 6fdb94e5eb15e69de304145860163de27489388e..04fd8a9691481e31c40849b05b051292cdac0f89 100644
--- a/net/udp/udp_socket_libevent.cc
+++ b/net/udp/udp_socket_libevent.cc
@@ -13,6 +13,7 @@
#include <sys/socket.h>
#include "base/callback.h"
+#include "base/debug/alias.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/sparse_histogram.h"
@@ -126,7 +127,12 @@ void UDPSocketLibevent::Close() {
ok = write_socket_watcher_.StopWatchingFileDescriptor();
DCHECK(ok);
- PCHECK(0 == IGNORE_EINTR(close(socket_)));
+ if (IGNORE_EINTR(close(socket_)) == -1) {
+ int last_error = errno;
+ base::debug::Alias(&last_error);
+ // Crash on any error other than EIO.
+ PCHECK(last_error == EIO);
+ }
socket_ = kInvalidSocket;
addr_family_ = 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698