mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Make kprintf_test resistant to limbo
This commit is contained in:
parent
711bd095db
commit
a277170c9a
1 changed files with 7 additions and 4 deletions
|
@ -245,13 +245,16 @@ TEST(ksnprintf, fuzzTheUnbreakable) {
|
||||||
|
|
||||||
TEST(kprintf, testFailure_wontClobberErrnoAndBypassesSystemCallSupport) {
|
TEST(kprintf, testFailure_wontClobberErrnoAndBypassesSystemCallSupport) {
|
||||||
int n;
|
int n;
|
||||||
|
const char *s = 0;
|
||||||
ASSERT_EQ(0, errno);
|
ASSERT_EQ(0, errno);
|
||||||
EXPECT_SYS(0, 3, dup(2));
|
EXPECT_SYS(0, 3, dup(2));
|
||||||
EXPECT_SYS(0, 0, close(2));
|
// <LIMBO>
|
||||||
|
if (close(2)) _Exit(200);
|
||||||
n = __syscount;
|
n = __syscount;
|
||||||
EXPECT_EQ(n, __syscount);
|
if (__syscount != n) _Exit(201);
|
||||||
EXPECT_EQ(0, errno);
|
if (errno != 0) _Exit(202);
|
||||||
EXPECT_SYS(0, 2, dup2(3, 2));
|
if (dup2(3, 2) != 2) _Exit(203);
|
||||||
|
// </LIMBO>
|
||||||
EXPECT_SYS(0, 0, close(3));
|
EXPECT_SYS(0, 0, close(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue