summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authortfarina <tfarina@chromium.org>2016-03-09 06:40:13 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-09 14:41:18 +0000
commit5967e5a288d75154a4fbcc2e5bf118acc27f38a9 (patch)
treef7fe9ce118cc01f11eabcd94ca53de920e8094a1 /base
parent5fe2fbbfe5061a6bb512d3866470d2bbf2c6c6d8 (diff)
downloadchromium_src-5967e5a288d75154a4fbcc2e5bf118acc27f38a9.zip
chromium_src-5967e5a288d75154a4fbcc2e5bf118acc27f38a9.tar.gz
chromium_src-5967e5a288d75154a4fbcc2e5bf118acc27f38a9.tar.bz2
base: simplify the first fcntl() call in SetNonBlocking() function
The third argument is not necessary for F_GETFL as documented at http://pubs.opengroup.org/onlinepubs/009695399/functions/fcntl.html. While at it, mark |flags| as const, as a protection measure, as it will not be modified later on. BUG=None TEST=base_unittests R=thestig@chromium.org Review URL: https://codereview.chromium.org/1771603002 Cr-Commit-Position: refs/heads/master@{#380136}
Diffstat (limited to 'base')
-rw-r--r--base/files/file_util_posix.cc2
-rw-r--r--base/sync_socket_posix.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc
index 802ed51..0e99b01 100644
--- a/base/files/file_util_posix.cc
+++ b/base/files/file_util_posix.cc
@@ -351,7 +351,7 @@ bool CopyDirectory(const FilePath& from_path,
#endif // !defined(OS_NACL_NONSFI)
bool SetNonBlocking(int fd) {
- int flags = fcntl(fd, F_GETFL, 0);
+ const int flags = fcntl(fd, F_GETFL);
if (flags == -1)
return false;
if (flags & O_NONBLOCK)
diff --git a/base/sync_socket_posix.cc b/base/sync_socket_posix.cc
index 7b9995ce..5d9e25e 100644
--- a/base/sync_socket_posix.cc
+++ b/base/sync_socket_posix.cc
@@ -222,7 +222,7 @@ size_t CancelableSyncSocket::Send(const void* buffer, size_t length) {
DCHECK_LE(length, kMaxMessageLength);
DCHECK_NE(handle_, kInvalidHandle);
- const long flags = fcntl(handle_, F_GETFL, NULL);
+ const int flags = fcntl(handle_, F_GETFL);
if (flags != -1 && (flags & O_NONBLOCK) == 0) {
// Set the socket to non-blocking mode for sending if its original mode
// is blocking.