blob: e863a7542b1d07bd52bccc825c1ce88b52bd25e5 [file] [log] [blame]
// RUN: test.sh -p -t %t %s
#include <assert.h>
#include <unistd.h>
// Ensure that a correct use of read() is not flagged as an error.
int main()
{
int pipefd[2];
char buf[1];
pipe(pipefd);
// Read nothing.
assert(read(pipefd[0], &buf[0], 0) == 0);
// Write a single character.
write(pipefd[1], "C", 1);
// Read back the same character.
assert(read(pipefd[0], &buf[0], 1) == 1 && buf[0] == 'C');
return 0;
}