Mail Archives: djgpp-workers/2001/01/30/17:34:57
> -extern char *__file_handle_modes;
> +extern unsigned short *__file_handle_modes;
Could this in any way affect already-compiled libraries or programs?
> Index: src/libc/ansi/stdio/doprnt.c
> +
> + if (fp->_flag & _IOAPPEND)
> + {
> + if ( llseek(fileno(fp), 0, SEEK_END) == -1 )
> + {
> + return (EOF);
> + }
> + }
This shouldn't be needed; the flsbuf() call should move to EOF.
> - n = _write(fileno(f), base, rn);
> + {
> + if ( f->_flag & _IOAPPEND )
> + {
> + int save_errno = errno; /* We don't want llseek()'s setting
> + errno to remain. */
> + if( llseek(fileno(f), 0, SEEK_END) == -1 )
> + {
> + errno = save_errno;
> + n = 0;
> + }
> + else
> + {
> + n = _write(fileno(f), base, rn);
> + }
> + }
> + else
> + {
> + n = _write(fileno(f), base, rn);
> + }
> + }
Can we remove all the else cases, and have llseek return a failure if
we can't seek? Then we'd have just one _write() call left (the
original one, left there).
> @@ -56,7 +57,9 @@ fopen(const char *file, const char *mode
> return NULL;
>
> if (*mode == 'a')
> - lseek(fd, 0, SEEK_END);
> + {
> + f->_flag |= _IOAPPEND;
> + }
Is this needed? write() would seek there anyway.
- Raw text -