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

Unified Diff: sandbox.cc

Issue 10399114: I am somewhat reluctantly changing the API so that setProcFD is no longer (Closed) Base URL: http://seccompsandbox.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 7 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 | sandbox_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox.cc
===================================================================
--- sandbox.cc (revision 185)
+++ sandbox.cc (working copy)
@@ -11,7 +11,6 @@
namespace playground {
// Global variables
-int Sandbox::proc_ = -1;
int Sandbox::proc_self_maps_ = -1;
enum Sandbox::SandboxStatus Sandbox::status_ = STATUS_UNKNOWN;
int Sandbox::pid_;
@@ -252,7 +251,13 @@
}
void Sandbox::setProcFd(int proc) {
- proc_ = proc;
+ if (proc >= 0) {
+ SysCalls sys;
+ proc_self_maps_ = sys.openat(proc, "self/maps", O_RDONLY, 0);
+ if (NOINTR_SYS(sys.close(proc))) {
+ die("Failed to close file descriptor pointing to /proc");
+ }
+ }
}
void Sandbox::startSandbox() {
@@ -263,13 +268,6 @@
}
SysCalls sys;
- if (proc_ >= 0) {
- proc_self_maps_ = sys.openat(proc_, "self/maps", O_RDONLY, 0);
- if (NOINTR_SYS(sys.close(proc_))) {
- die("Failed to close file descriptor pointing to /proc");
- }
- proc_ = -1;
- }
if (proc_self_maps_ < 0) {
proc_self_maps_ = sys.open("/proc/self/maps", O_RDONLY, 0);
if (proc_self_maps_ < 0) {
« no previous file with comments | « no previous file | sandbox_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698