fd = failtest_open("run-open-scratchpad", "run-open.c", 1,
O_RDWR|O_CREAT, 0600);
if (fd == -1) {
/* We are the child: write error code for parent to check. */
err = errno;
fd = failtest_open("run-open-scratchpad", "run-open.c", 1,
O_RDWR|O_CREAT, 0600);
if (fd == -1) {
/* We are the child: write error code for parent to check. */
err = errno;
fd = failtest_open("run-open-scratchpad", "run-open.c", 1, O_RDONLY);
if (fd == -1) {
/* We are the child: write error code for parent to check. */
err = errno;
fd = failtest_open("run-open-scratchpad", "run-open.c", 1, O_RDONLY);
if (fd == -1) {
/* We are the child: write error code for parent to check. */
err = errno;
ok1(read(fd, buf, strlen("Hello world!")) == strlen("Hello world!"));
ok1(strcmp(buf, "Hello world!") == 0);
/* Clean up. */
ok1(read(fd, buf, strlen("Hello world!")) == strlen("Hello world!"));
ok1(strcmp(buf, "Hello world!") == 0);
/* Clean up. */