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

Unified Diff: third_party/crashpad/crashpad/test/multiprocess_exec_test_child.cc

Issue 2478633002: Update Crashpad to b47bf6c250c6b825dee1c5fbad9152c2c962e828 (Closed)
Patch Set: mac comment 2 Created 4 years, 1 month 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
Index: third_party/crashpad/crashpad/test/multiprocess_exec_test_child.cc
diff --git a/third_party/crashpad/crashpad/test/multiprocess_exec_test_child.cc b/third_party/crashpad/crashpad/test/multiprocess_exec_test_child.cc
index c796e4a3ab9a211c49568b8bd6e0c653e17dae0c..011a37d09c9e375fb52fd23552db68972031c2ef 100644
--- a/third_party/crashpad/crashpad/test/multiprocess_exec_test_child.cc
+++ b/third_party/crashpad/crashpad/test/multiprocess_exec_test_child.cc
@@ -27,6 +27,7 @@
#endif
#if defined(OS_POSIX)
+#include <sys/resource.h>
#include <unistd.h>
#elif defined(OS_WIN)
#include <windows.h>
@@ -37,9 +38,13 @@ int main(int argc, char* argv[]) {
// Make sure that there’s nothing open at any FD higher than 3. All FDs other
// than stdin, stdout, and stderr should have been closed prior to or at
// exec().
- int max_fd = std::max(static_cast<int>(sysconf(_SC_OPEN_MAX)), OPEN_MAX);
- max_fd = std::max(max_fd, getdtablesize());
- for (int fd = STDERR_FILENO + 1; fd < max_fd; ++fd) {
+ rlimit rlimit_nofile;
+ if (getrlimit(RLIMIT_NOFILE, &rlimit_nofile) != 0) {
+ abort();
+ }
+ for (int fd = STDERR_FILENO + 1;
+ fd < static_cast<int>(rlimit_nofile.rlim_cur);
+ ++fd) {
if (close(fd) == 0 || errno != EBADF) {
abort();
}

Powered by Google App Engine
This is Rietveld 408576698