Commit fb9514a5 authored by Rusty Russell's avatar Rusty Russell

failtest: don't insist parents and children write the same thing to files.

We insist they write the same things to pipes, since we can't "undo" them,
but strictly speaking we don't care if they write different things into
files.

Note: it may indicate a bug if they do...
parent 5adceea6
......@@ -663,8 +663,9 @@ ssize_t failtest_pwrite(int fd, const void *buf, size_t count, off_t off,
call.off = off;
p = add_history(FAILTEST_WRITE, file, line, &call);
/* If we're a child, tell parent about write. */
if (control_fd != -1) {
/* If we're a child, we need to make sure we write the same thing
* to non-files as the parent does, so tell it. */
if (control_fd != -1 && off == (off_t)-1) {
enum info_type type = WRITE;
write_all(control_fd, &type, sizeof(type));
......@@ -678,7 +679,7 @@ ssize_t failtest_pwrite(int fd, const void *buf, size_t count, off_t off,
p->error = EIO;
} else {
/* FIXME: We assume same write order in parent and child */
if (child_writes_num != 0) {
if (off == (off_t)-1 && child_writes_num != 0) {
if (child_writes[0].fd != fd)
errx(1, "Child wrote to fd %u, not %u?",
child_writes[0].fd, fd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment