X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/31cef89cb428866f787983e68246030321893df4..4b9ccde74dc34e450ed96bcd3d044f78cf393d8d:/usr/src/libc/stdio/ftell.c diff --git a/usr/src/libc/stdio/ftell.c b/usr/src/libc/stdio/ftell.c index b33252b8cd..e2226c8656 100644 --- a/usr/src/libc/stdio/ftell.c +++ b/usr/src/libc/stdio/ftell.c @@ -1,3 +1,4 @@ +/* @(#)ftell.c 4.2 (Berkeley) 3/9/81 */ /* * Return file offset. * Coordinates with buffering. @@ -17,9 +18,9 @@ FILE *iop; iop->_cnt = 0; if (iop->_flag&_IOREAD) adjust = - iop->_cnt; - else if (iop->_flag&_IOWRT) { + else if (iop->_flag&(_IOWRT|_IORW)) { adjust = 0; - if (iop->_base && (iop->_flag&_IONBF)==0) + if (iop->_flag&_IOWRT && iop->_base && (iop->_flag&_IONBF)==0) adjust = iop->_ptr - iop->_base; } else return(-1);