0
1
mirror of https://github.com/termux/proot.git synced 2024-11-11 13:49:26 +00:00
proot/tests/test-1ffc8309.c
2016-08-21 07:42:00 -04:00

31 lines
461 B
C

#define _GNU_SOURCE
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
int main()
{
int fds[2];
int status;
uint8_t buffer;
status = pipe2(fds, O_NONBLOCK);
if (status < 0) {
perror("pipe2");
exit(EXIT_FAILURE);
}
(void) alarm(5);
(void) read(fds[0], &buffer, 1);
if (errno != EAGAIN && errno != EWOULDBLOCK) {
perror("read");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}