diff -r ecbae90ae88d -r 684c583cb586 platform/posix.c --- a/platform/posix.c Wed Mar 12 21:42:16 2008 +0000 +++ b/platform/posix.c Thu Apr 03 05:05:48 2008 +0000 @@ -236,13 +236,26 @@ static void *doOpen(const char *filename, int mode) { + const int appending = (mode & O_APPEND); int fd; int *retval; errno = 0; + /* O_APPEND doesn't actually behave as we'd like. */ + mode &= ~O_APPEND; + fd = open(filename, mode, S_IRUSR | S_IWUSR); BAIL_IF_MACRO(fd < 0, strerror(errno), NULL); + if (appending) + { + if (lseek(fd, 0, SEEK_END) < 0) + { + close(fd); + BAIL_MACRO(strerror(errno), NULL); + } /* if */ + } /* if */ + retval = (int *) allocator.Malloc(sizeof (int)); if (retval == NULL) {