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

Unified Diff: sandbox/linux/services/credentials.cc

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 10 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 | « sandbox/linux/BUILD.gn ('k') | sandbox/linux/services/proc_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/services/credentials.cc
diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
index e571ddec59776a58a1810b22bf83ba4c63b8ba58..ed21fd192bd0c7eda1ffaadcbf6583c26f18751d 100644
--- a/sandbox/linux/services/credentials.cc
+++ b/sandbox/linux/services/credentials.cc
@@ -114,7 +114,7 @@ bool ChrootToSafeEmptyDir() {
int status = -1;
PCHECK(HANDLE_EINTR(waitpid(pid, &status, 0)) == pid);
- return kExitSuccess == status;
+ return WIFEXITED(status) && WEXITSTATUS(status) == kExitSuccess;
}
// CHECK() that an attempt to move to a new user namespace raised an expected
@@ -174,12 +174,14 @@ bool Credentials::CanCreateProcessInNewUserNS() {
// have disappeared. Make sure to not do anything in the child, as this is a
// fragile execution environment.
if (pid == 0) {
- _exit(0);
+ _exit(kExitSuccess);
}
// Always reap the child.
- siginfo_t infop;
- PCHECK(0 == HANDLE_EINTR(waitid(P_PID, pid, &infop, WEXITED)));
+ int status = -1;
+ PCHECK(HANDLE_EINTR(waitpid(pid, &status, 0)) == pid);
+ CHECK(WIFEXITED(status));
+ CHECK_EQ(kExitSuccess, WEXITSTATUS(status));
// clone(2) succeeded, we can use CLONE_NEWUSER.
return true;
« no previous file with comments | « sandbox/linux/BUILD.gn ('k') | sandbox/linux/services/proc_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698