Skip to content

Commit d4383b4

Browse files
authored
Merge pull request #125 from alexcrichton/update-pwrite-with-append
Accept either POSIX or Linux behavior in `pwrite-with-append.c`
2 parents 7aafc04 + c26ba04 commit d4383b4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/c/src/pwrite-with-append.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ int main() {
2424
size = pwrite(fd, buf, 3, 0);
2525
assert(size == 3);
2626

27-
// fd_pwrite should write from offset 0 regardless of append.
28-
// (thus shouln't extend the file.)
29-
// it shouldn't move the file offset either.
27+
// fd_pwrite shouldn't update the current offset. POSIX says it should write
28+
// at 0, Linux says it should write at the end with `O_APPEND`. Accept either.
3029
assert(lseek(fd, 0, SEEK_CUR) == 4);
31-
assert(lseek(fd, 0, SEEK_END) == 4);
30+
int end = lseek(fd, 0, SEEK_END);
31+
assert(end == 4 || end == 7);
3232

3333
close(fd);
3434

0 commit comments

Comments
 (0)