Mail Archives: djgpp-workers/2001/03/31/15:25:20
> From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
> Date: Sat, 31 Mar 2001 19:57:43 +0200 (MEST)
>
> --- fopen.c 1995/08/23 07:49:24 1.1
> +++ fopen.c 2001/03/31 17:42:18
> @@ -1,3 +1,4 @@
> +/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
> /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
> #include <libc/stubs.h>
> #include <sys/types.h>
> @@ -29,7 +30,7 @@ fopen(const char *file, const char *mode
> switch (*mode)
> {
> case 'a':
> - oflags = O_CREAT | (rw ? O_RDWR : O_WRONLY);
> + oflags = O_CREAT | (rw ? O_RDWR : O_WRONLY) | O_APPEND;
> break;
> case 'r':
> oflags = rw ? O_RDWR : O_RDONLY;
> @@ -55,9 +56,6 @@ fopen(const char *file, const char *mode
> if (fd < 0)
> return NULL;
>
> - if (*mode == 'a')
> - lseek(fd, 0, SEEK_END);
> -
What does ANSI C say about the file stream position right after it is
open with "a" mode? If it says it should be at the file's end, you
cannot remove the above lseek.
> --- fcntl.c 2001/02/01 19:19:24 1.5
> +++ fcntl.c 2001/03/31 17:42:27
> @@ -408,7 +408,8 @@ fcntl(int fd, int cmd, ...)
>
> case F_GETFL:
> {
> - return 0;
> + return 0; /* FIXME: should use the data in the SFT, and the
> + FILE_DESC_APPEND flag in __fd_properties */
Any reason not to do this now?
- Raw text -