Deleted Added
full compact
37c37
< __FBSDID("$FreeBSD: head/lib/libc/stdio/ftell.c 268997 2014-07-22 22:49:37Z ache $");
---
> __FBSDID("$FreeBSD: head/lib/libc/stdio/ftell.c 289863 2015-10-24 02:23:15Z ache $");
91d90
< int dflags;
123,136c122,137
< dflags = 0;
< if (fp->_flags & __SAPP)
< dflags = O_APPEND;
< else if (fp->_file != -1 &&
< (dflags = _fcntl(fp->_file, F_GETFL)) < 0)
< return (1);
< if ((dflags & O_APPEND) &&
< (pos = _sseek(fp, (fpos_t)0, SEEK_END)) == -1) {
< if ((fp->_flags & __SOPT) || __sflush(fp) ||
< (pos = _sseek(fp, (fpos_t)0, SEEK_CUR)) == -1)
< return (1);
< else {
< *offset = pos;
< return (0);
---
> /* XXX: Reuse __SALC for O_APPEND. */
> if (fp->_flags & (__SAPP|__SALC)) {
> int serrno = errno;
>
> errno = 0;
> if ((pos = _sseek(fp, (fpos_t)0, SEEK_END)) == -1) {
> if (errno == ESPIPE ||
> (fp->_flags & __SOPT) || __sflush(fp) ||
> (pos =
> _sseek(fp, (fpos_t)0, SEEK_CUR)) == -1)
> return (1);
> else {
> errno = serrno;
> *offset = pos;
> return (0);
> }
137a139
> errno = serrno;