diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-02 02:28:16 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-02 02:28:16 +0000 |
commit | cabe39c43a98b6b635951d5cb3649e061e36ea21 (patch) | |
tree | c76282b5ed8452f490edbda9ed0a32bf364b5d6a /base/process_util_posix.cc | |
parent | ce716d859764f7a6e8ea0c79bbcd445d856f4da0 (diff) | |
download | chromium_src-cabe39c43a98b6b635951d5cb3649e061e36ea21.zip chromium_src-cabe39c43a98b6b635951d5cb3649e061e36ea21.tar.gz chromium_src-cabe39c43a98b6b635951d5cb3649e061e36ea21.tar.bz2 |
linux: check the return value passed through HANDLE_EINTR
A smarter compiler (clang) can notice that we were not using the return
values being passed through HANDLE_EINTR, which meant most frequently
that we were missing checking the return value of close().
Review URL: http://codereview.chromium.org/569003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_posix.cc')
-rw-r--r-- | base/process_util_posix.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc index f49ba7e..a29304d 100644 --- a/base/process_util_posix.cc +++ b/base/process_util_posix.cc @@ -16,6 +16,7 @@ #include <limits> #include <set> +#include "base/compiler_specific.h" #include "base/debug_util.h" #include "base/eintr_wrapper.h" #include "base/logging.h" @@ -223,7 +224,9 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { if (saved_fds.find(fd) != saved_fds.end()) continue; - HANDLE_EINTR(close(fd)); + // Since we're just trying to close anything we can find, + // ignore any error return values of close(). + int unused ALLOW_UNUSED = HANDLE_EINTR(close(fd)); } return; } @@ -249,8 +252,10 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { // own use and will complain if we try to close them. All of // these FDs are >= |max_fds|, so we can check against that here // before closing. See https://bugs.kde.org/show_bug.cgi?id=191758 - if (fd < static_cast<int>(max_fds)) - HANDLE_EINTR(close(fd)); + if (fd < static_cast<int>(max_fds)) { + int ret = HANDLE_EINTR(close(fd)); + DPCHECK(ret == 0); + } } } @@ -436,8 +441,10 @@ bool LaunchApp( _exit(127); } else { // Parent process - if (wait) - HANDLE_EINTR(waitpid(pid, 0, 0)); + if (wait) { + pid_t ret = HANDLE_EINTR(waitpid(pid, 0, 0)); + DPCHECK(ret > 0); + } if (process_handle) *process_handle = pid; |