Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | In > LONG_MAX test use sseek return value and not _offset which can be not | ache | 2001-10-25 | 1 | -3/+4 |
| | | | | active. | ||||
* | Help to recover from bad seek (i.e. negative or too big) happens beyond | ache | 2001-10-24 | 2 | -5/+12 |
| | | | | | our pre-check control. Do the same way as refill.c does when it set __SERR, i.e. clear read and ungetc buffers. Clear EOF flag too. | ||||
* | Back out read buffer invalidating via __SMOD. | ache | 2001-10-23 | 2 | -7/+2 |
| | | | | | It was correct, but not needed because internal buffer cleared on each seek outside of it. | ||||
* | Change comment explaining another usage of __SMOD | ache | 2001-10-23 | 1 | -2/+2 |
| | |||||
* | Disallow fseek() optimization in internal read buffer, if pointer is moved by | ache | 2001-10-23 | 1 | -0/+5 |
| | | | | | seek. It means that beginning of read buffer becomes not the same as current file position. | ||||
* | Fixed style bugs in previous commit. | bde | 2001-10-15 | 1 | -15/+15 |
| | |||||
* | Make this compile on ia64. | dfr | 2001-10-14 | 1 | -25/+46 |
| | |||||
* | mdoc(7) police: Use the new .In macro for #include statements. | ru | 2001-10-01 | 20 | -23/+23 |
| | |||||
* | 1) If __SAPP stream is not seekable, remove __SAPP flag on first call instead | ache | 2001-09-07 | 1 | -3/+10 |
| | | | | | | | | | of repeating unsuccessful lseek call on each write (original stdio bug). 2) Save errno accross _sseek call in _swrite to not touch it in case write success (original stdio bug). 3) Add _sseek error checking back, but only for __SOPT mode now. | ||||
* | For now just back out seek error checking in __SAPP case, it cause problems | ache | 2001-09-07 | 1 | -2/+2 |
| | | | | | | with non-seekable streams. Now here is what here was originally, but it is ugly, producing unneded seek syscall on each non-seekable stream write. I'll think about proper solution later. | ||||
* | When __SOPT is cleared, clear __SOFF too. | ache | 2001-09-03 | 1 | -1/+1 |
| | | | | NOTE: original stdio bug. | ||||
* | Re-arrange my funopen(3) fix to minimize differences with original stdio code, | ache | 2001-09-03 | 6 | -83/+91 |
| | | | | | | no functional changes. Add fp->_offset optimization in _SAPP+_SOPT case | ||||
* | Internal seeks are overoptimized. They should remember fp->_offset only for | ache | 2001-09-02 | 2 | -3/+1 |
| | | | | | | | plain regular files, i.e. files with __SOPT flag set. Fix it, so ftell(stdout) always returns the same as lseek(1, 0, 1) now. NOTE: this bug was in original stdio code | ||||
* | Fix bug in off_t overflow checking: if fp->_offset overflows, just remove | ache | 2001-09-02 | 1 | -5/+3 |
| | | | | | __SOFF flag (i.e. we don't have offset) instead of returning EOVERFLOW. It allows again continious reading from non-stop stream. | ||||
* | Typo seek(2) -> lseek(2) | ache | 2001-09-02 | 1 | -1/+1 |
| | |||||
* | Move all stdio internal flags processing and setting out of __sread(), | ache | 2001-09-02 | 9 | -55/+89 |
| | | | | | | | | | | __swrite() and __sseek() to higher level. According to funopen(3) they all are just wrappers to something like standard read(2), write(2) and lseek(2), i.e. must not touch stdio internals because they are replaceable with any other functions knows nothing about stdio internals. See example of funopen(3) usage in sendmail sources f.e. NOTE: this is original stdio bug, not result of my range checkin added. | ||||
* | Save errno before function call and restore it on success (because many | ache | 2001-09-01 | 2 | -2/+11 |
| | | | | | | internal functions there may fail and set (i.e. overwrite) errno in normal (not error) situation). In original variant errno testing after call (as POSIX suggest) is wrong when errno overwrite happens. | ||||
* | Remove even more unneded checks, original code can't overflows in that place | ache | 2001-09-01 | 1 | -5/+1 |
| | |||||
* | Remove two checks unneeded now (can't happens) | ache | 2001-09-01 | 1 | -4/+0 |
| | |||||
* | Make fseek(... SEEK_CUR) fails if current file-position is unspecified. | ache | 2001-09-01 | 2 | -8/+8 |
| | |||||
* | Note that prev. commit addition is for ftell/ftello | ache | 2001-09-01 | 1 | -2/+6 |
| | |||||
* | Describe ESPIPE as result of unspecified file-position indicator value. | ache | 2001-09-01 | 1 | -2/+7 |
| | | | | Add more to SEE ALSO section. | ||||
* | Describe file-position behaviour from POSIX | ache | 2001-09-01 | 1 | -0/+5 |
| | |||||
* | Strict in the POSIX sence, if file position is unspecified after ungetc() at | ache | 2001-09-01 | 1 | -6/+4 |
| | | | | | | | 0, return that we can't specify it, i.e. error with ESPIPE. (hint from: "Peter S. Housel" <housel@acm.org>) Back out sinit() addition, not needed after various code simplifications. | ||||
* | If lseek to wrong value sucessfully happens despite all pre-checks, set __SERR | ache | 2001-09-01 | 2 | -1/+4 |
| | | | | to indicate that stream becomes inconsistent. | ||||
* | If position is underflowed, don't try to hide that fact by recovery, just | ache | 2001-09-01 | 1 | -17/+7 |
| | | | | return EIO and set __SERR to mark stream as inconsistent. | ||||
* | Back out disabling ungetc() at 0, use different solution: | ache | 2001-09-01 | 5 | -34/+48 |
| | | | | | keep negative offset internally, but return 0 externally in ftell*() I.e. use 0 now as 'unspecified value' per POSIX ungetc() description. | ||||
* | Add originally missing __sinit() call. | ache | 2001-08-31 | 1 | -0/+4 |
| | |||||
* | Simplify offset underflow checks even more | ache | 2001-08-31 | 1 | -12/+2 |
| | |||||
* | Describe that we disallow ungetc at offset 0 now. | ache | 2001-08-31 | 1 | -1/+4 |
| | |||||
* | Disallow ungetc at offset 0 (to prevent negative offset happens), so simplify | ache | 2001-08-31 | 2 | -22/+15 |
| | | | | checks in ftell. | ||||
* | Drop buffer first, _then_ ask for real position | ache | 2001-08-31 | 1 | -4/+4 |
| | |||||
* | The same big piece of ftell code repeated in 3 places. Simplify things moving | ache | 2001-08-31 | 3 | -94/+30 |
| | | | | | it into one subfunction instead. Try to use real offset in strange cases. | ||||
* | If file offset is smaller than internal buffer character left count, just drop | ache | 2001-08-31 | 2 | -16/+30 |
| | | | | internal buffer and trust offset, not return error. | ||||
* | Initialize _offset to 0 in fopen(), it helps to optimize fseek/ftell | ache | 2001-08-31 | 1 | -0/+2 |
| | |||||
* | Detect fp->_offset overflow on read | ache | 2001-08-31 | 1 | -9/+23 |
| | | | | Use errno to catch negative seek with -1 offset | ||||
* | Use ``.Rv -std'' wherever possible. | ru | 2001-08-31 | 1 | -7/+3 |
| | | | | Submitted by: yar | ||||
* | Try to discard some ungetc data in saved internal buffer checks too, | ache | 2001-08-30 | 2 | -7/+25 |
| | | | | if offset tends to be negative. | ||||
* | goto dumb; if can't obtain curoff for whence != SEEK_CUR cases, as supposed | ache | 2001-08-30 | 1 | -8/+4 |
| | |||||
* | Add more EOVERFLOW checks. | ache | 2001-08-30 | 2 | -31/+94 |
| | | | | | | | | | | | | When file offset tends to be negative due to internal and ungetc buffers additions counted, try to discard some ungetc data first, then return EBADF. Later one can happens if lseek(fileno(fd),...) called f.e. POSIX says that ungetc beyond beginning of the file results are undefined, so we can just discard some of ungetc data in that case. Don't rely on gcc cast when checking for overflow, use OFF_MAX. Cosmetique. | ||||
* | Cosmetique fixes from bde | ache | 2001-08-26 | 1 | -2/+0 |
| | |||||
* | Cosmetique: correct English in comments | ache | 2001-08-23 | 1 | -2/+2 |
| | |||||
* | Mark some functions as __printflike() and/or taking const char * arguments | kris | 2001-08-20 | 1 | -1/+1 |
| | | | | | | instead of char *. MFC after: 2 weeks | ||||
* | Add about rewind+errno, describe ESPIPE, minor formatting. | ache | 2001-08-19 | 1 | -6/+23 |
| | |||||
* | Simplify overflow calculations a bit | ache | 2001-08-17 | 1 | -4/+2 |
| | |||||
* | Remove extra check, already done in upper level caller, i.e. in | ache | 2001-08-17 | 1 | -5/+1 |
| | | | | _fseeko() | ||||
* | Mention ftell & ftello in EOVERFLOW section too. | ache | 2001-08-17 | 1 | -1/+5 |
| | |||||
* | Add more overflow checks in case of fseek() | ache | 2001-08-17 | 1 | -0/+8 |
| | |||||
* | Don't clear "we have offset" flag even if long is overflow for fseek(), | ache | 2001-08-17 | 1 | -1/+0 |
| | | | | there is no harm to have it, it will reduce next call efforts. | ||||
* | fseek.c: | ache | 2001-08-17 | 4 | -10/+36 |
| | | | | | | | | | | | | Resulting fseek() offset must fit in long, required by POSIX (pointed by bde), so add LONG_MAX and final tests for it. rewind.c: 1) add missing __sinit() as in fseek() it pretends to be. 2) use clearerr_unlocked() since we already lock stream before _fseeko() 3) don't zero errno at the end, it explicitely required by POSIX as the only one method to test rewind() error condition. 4) don't clearerr() if error happens in _fseeko() |