2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

zdtm: don't trigger BUG if futex returns EINTR

It can hapen in tty tests, where we get SIGHUP.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Andrei Vagin 2016-08-20 03:18:00 +03:00 committed by Pavel Emelyanov
parent 18c0fbc27c
commit ada6312984
2 changed files with 5 additions and 3 deletions

View File

@ -64,7 +64,7 @@ static inline void futex_add_and_wake(futex_t *f, uint32_t v)
break; \
ret = sys_futex(&(__f)->raw, FUTEX_WAIT,\
tmp, NULL, NULL, 0); \
if (ret < 0 && errno == EAGAIN) \
if (ret < 0 && (errno == EAGAIN || errno == EINTR)) \
continue; \
BUG_ON(ret < 0 && errno != EWOULDBLOCK); \
} \
@ -119,7 +119,7 @@ static inline uint32_t futex_wait_while(futex_t *f, uint32_t v)
{
while (f->raw == v) {
int ret = sys_futex(&f->raw, FUTEX_WAIT, v, NULL, NULL, 0);
if (ret < 0 && errno == EAGAIN)
if (ret < 0 && (errno == EAGAIN || errno == EINTR))
continue;
BUG_ON(ret < 0 && errno != EWOULDBLOCK);
}

View File

@ -97,8 +97,10 @@ int main(int argc, char ** argv)
fail("The child returned %d", WEXITSTATUS(status));
return 1;
}
} else
} else {
test_msg("The child has been killed by %d\n", WTERMSIG(status));
return 1;
}
pass();