diff options
author | jbeich <jbeich@FreeBSD.org> | 2018-05-08 08:35:03 +0800 |
---|---|---|
committer | jbeich <jbeich@FreeBSD.org> | 2018-05-08 08:35:03 +0800 |
commit | e95c7d698f01dc99de263d015f96e72fbc7ec79d (patch) | |
tree | 0c840f9f2beba4ca414822dde92abd958b67aceb | |
parent | 65ecf640034e276198de3855261b82edd7a3cecc (diff) | |
download | freebsd-ports-gnome-e95c7d698f01dc99de263d015f96e72fbc7ec79d.tar.gz freebsd-ports-gnome-e95c7d698f01dc99de263d015f96e72fbc7ec79d.tar.zst freebsd-ports-gnome-e95c7d698f01dc99de263d015f96e72fbc7ec79d.zip |
www/firefox: close unwanted fds
-rw-r--r-- | www/firefox/Makefile | 2 | ||||
-rw-r--r-- | www/firefox/files/patch-bug1400051 | 157 |
2 files changed, 158 insertions, 1 deletions
diff --git a/www/firefox/Makefile b/www/firefox/Makefile index 3256200350f7..6ba81f756a4e 100644 --- a/www/firefox/Makefile +++ b/www/firefox/Makefile @@ -3,7 +3,7 @@ PORTNAME= firefox DISTVERSION= 60.0 -PORTREVISION= 2 +PORTREVISION= 3 PORTEPOCH= 1 CATEGORIES= www ipv6 MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \ diff --git a/www/firefox/files/patch-bug1400051 b/www/firefox/files/patch-bug1400051 new file mode 100644 index 000000000000..bbf2ead0a5d5 --- /dev/null +++ b/www/firefox/files/patch-bug1400051 @@ -0,0 +1,157 @@ +Switch to fork/exec on BSDs due to lack of POSIX_SPAWN_CLOEXEC_DEFAULT + +diff --git ipc/chromium/moz.build ipc/chromium/moz.build +index 7888251982e8e..fc80456237765 100644 +--- ipc/chromium/moz.build ++++ ipc/chromium/moz.build +@@ -93,21 +93,7 @@ if os_macosx: + 'src/base/platform_thread_mac.mm', + ] + +-if os_bsd: +- SOURCES += [ +- 'src/base/atomicops_internals_x86_gcc.cc', +- 'src/base/time_posix.cc', +- ] +- if CONFIG['OS_ARCH'] == 'GNU_kFreeBSD': +- SOURCES += [ +- 'src/base/process_util_linux.cc' +- ] +- else: +- SOURCES += [ +- 'src/base/process_util_bsd.cc' +- ] +- +-if os_linux: ++if os_posix and not os_macosx: + SOURCES += [ + 'src/base/atomicops_internals_x86_gcc.cc', + 'src/base/process_util_linux.cc', +@@ -119,20 +105,11 @@ if os_linux: + ] + DEFINES['ANDROID'] = True + DEFINES['_POSIX_MONOTONIC_CLOCK'] = 0 +- +-if os_bsd or os_linux: + if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: + SOURCES += [ + 'src/base/message_pump_glib.cc', + ] + +-if os_solaris: +- SOURCES += [ +- 'src/base/atomicops_internals_x86_gcc.cc', +- 'src/base/process_util_linux.cc', +- 'src/base/time_posix.cc', +- ] +- + ost = CONFIG['OS_TEST'] + if '86' not in ost and 'arm' not in ost and 'aarch64' != ost and 'mips' not in ost: + SOURCES += [ +diff --git ipc/chromium/src/base/process_util_bsd.cc ipc/chromium/src/base/process_util_bsd.cc +deleted file mode 100644 +index 614a5e55116cd..0000000000000 +--- ipc/chromium/src/base/process_util_bsd.cc ++++ /dev/null +@@ -1,101 +0,0 @@ +-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +-/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +-// Copyright (c) 2008 The Chromium Authors. All rights reserved. +-// Use of this source code is governed by a BSD-style license that can be +-// found in the LICENSE file. +- +-// derived from process_util_mac.cc +- +-#include "base/process_util.h" +- +-#include <fcntl.h> +-#include <spawn.h> +-#include <sys/wait.h> +- +-#include <string> +- +-#include "base/eintr_wrapper.h" +- +-namespace { +- +-static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG"); +- +-} // namespace +- +-namespace base { +- +- +-bool LaunchApp(const std::vector<std::string>& argv, +- const LaunchOptions& options, +- ProcessHandle* process_handle) +-{ +- bool retval = true; +- +- char* argv_copy[argv.size() + 1]; +- for (size_t i = 0; i < argv.size(); i++) { +- argv_copy[i] = const_cast<char*>(argv[i].c_str()); +- } +- argv_copy[argv.size()] = NULL; +- +- // Make sure we don't leak any FDs to the child process by marking all FDs +- // as close-on-exec. +- SetAllFDsToCloseOnExec(); +- +- EnvironmentArray vars = BuildEnvironmentArray(options.env_map); +- +- posix_spawn_file_actions_t file_actions; +- if (posix_spawn_file_actions_init(&file_actions) != 0) { +- return false; +- } +- +- // Turn fds_to_remap array into a set of dup2 calls. +- for (const auto& fd_map : options.fds_to_remap) { +- int src_fd = fd_map.first; +- int dest_fd = fd_map.second; +- +- if (src_fd == dest_fd) { +- int flags = fcntl(src_fd, F_GETFD); +- if (flags != -1) { +- fcntl(src_fd, F_SETFD, flags & ~FD_CLOEXEC); +- } +- } else { +- if (posix_spawn_file_actions_adddup2(&file_actions, src_fd, dest_fd) != 0) { +- posix_spawn_file_actions_destroy(&file_actions); +- return false; +- } +- } +- } +- +- pid_t pid = 0; +- int spawn_succeeded = (posix_spawnp(&pid, +- argv_copy[0], +- &file_actions, +- NULL, +- argv_copy, +- vars.get()) == 0); +- +- posix_spawn_file_actions_destroy(&file_actions); +- +- bool process_handle_valid = pid > 0; +- if (!spawn_succeeded || !process_handle_valid) { +- retval = false; +- } else { +- gProcessLog.print("==> process %d launched child process %d\n", +- GetCurrentProcId(), pid); +- if (options.wait) +- HANDLE_EINTR(waitpid(pid, 0, 0)); +- +- if (process_handle) +- *process_handle = pid; +- } +- +- return retval; +-} +- +-bool LaunchApp(const CommandLine& cl, +- const LaunchOptions& options, +- ProcessHandle* process_handle) { +- return LaunchApp(cl.argv(), options, process_handle); +-} +- +-} // namespace base |