mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Perform some code cleanup
This commit is contained in:
parent
0dd9629562
commit
a4601a24d3
63 changed files with 350 additions and 1643 deletions
|
@ -33,8 +33,23 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
#include "tool/net/sandbox.h"
|
||||
|
||||
// It's been reported that Chromebooks return EINVAL here.
|
||||
bool CanUseSeccomp(void) {
|
||||
int ws, pid;
|
||||
ASSERT_NE(-1, (pid = fork()));
|
||||
if (!pid) {
|
||||
if (seccomp(SECCOMP_SET_MODE_STRICT, 0, 0) != -1) {
|
||||
_Exit1(0);
|
||||
} else {
|
||||
_Exit1(1);
|
||||
}
|
||||
}
|
||||
EXPECT_NE(-1, wait(&ws));
|
||||
return WIFEXITED(ws) && !WEXITSTATUS(ws);
|
||||
}
|
||||
|
||||
void SetUp(void) {
|
||||
if (!__is_linux_2_6_23()) {
|
||||
if (!__is_linux_2_6_23() || !CanUseSeccomp()) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue