| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
keep negative offset internally, but return 0 externally in ftell*()
I.e. use 0 now as 'unspecified value' per POSIX ungetc() description.
|
| |
|
| |
|
| |
|
|
|
|
| |
checks in ftell.
|
| |
|
|
|
|
|
| |
it into one subfunction instead.
Try to use real offset in strange cases.
|
|
|
|
| |
internal buffer and trust offset, not return error.
|
| |
|
|
|
|
| |
Use errno to catch negative seek with -1 offset
|
|
|
|
| |
Submitted by: yar
|
|
|
|
| |
if offset tends to be negative.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
instead of char *.
MFC after: 2 weeks
|
| |
|
| |
|
|
|
|
| |
_fseeko()
|
| |
|
| |
|
|
|
|
| |
there is no harm to have it, it will reduce next call efforts.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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()
|
|
|
|
| |
Submitted by: ru
|
|
|
|
| |
Suggested by: bde
|
|
|
|
|
|
|
|
|
|
|
|
| |
"[EINVAL] ... The resulting file-position indicator would be set to a
negative value."
Moreover, in real life negative seek in stdio cause EOF indicator cleared
and not set again forever even if EOF returned.
2) Catch few possible off_t overflows.
Reviewed by: arch discussion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was foiled because of dynamic copy relocations that caused compile-time
space to be reserved in .bss and at run time a blob of data was copied to
that space and everything used the .bss version.. The problem is that
the space is reserved at compile time, not runtime... So we *still* could
not change the size of FILE. Sigh. :-(
Replace it with something that does actually work and really does let us
make 'FILE' extendable. It also happens to be the same as Linux does in
glibc, but has the slight cost of a pointer. Note that this is the
same cost that 'fp = fopen(), fprintf(fp, ...); fclose(fp);' has.
Fortunately, actual references to stdin/out/err are not all that common
since we have implicit stdin/out/err-using versions of functions
(printf() vs. fprintf()).
|
| |
|
|
|
|
| |
Reviewed by: ru
|
|
|
|
|
|
|
| |
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
|
|
|
|
|
|
|
|
| |
or developers' vendors without compromising the importance of warning
against bad practice.
Reported by: mjacob
MFC after: 1 week
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
directory, defaulting to /tmp.
PR: bin/16924
Reviewed by: dd
MFC after: 2 weeks
|
| |
|
|
|
|
|
|
|
|
| |
PR: misc/26044
MFC after: 1 week
Submitted by: bde
|
|
|
|
|
|
| |
(this will be fixed in a better way)
PR: misc/26044
|
|
|
|
|
|
| |
PR: misc/26044
MFC after: 1 week
|
|
|
|
|
|
|
|
| |
from the 'l' description with s/long/long long/g.
PR: 27017
Submitted by: Guy Harris <guy@alum.mit.edu>
MFC after: 2 weeks
|
|
|
|
|
|
|
| |
was from the iso standard. Keep the sentence that says it is always
NUL terminated to make sure that people understand that.
Requested by: bde
|
|
|
|
|
|
| |
o Explain snprintf's return value better.
o Document snprintf, et al, were defined in C-99
o Warn against %n.
|
|
|
|
|
|
|
| |
The change to reuse _up from FILE (to allow FILE to grow without changing
size) overlooked FILE being allocated off the stack.
Approved by: sobomax
|
|
|
|
|
|
|
| |
return the number of characters that would have been in the new string.
Obtained from: OpenBSD
MFC after: 3 days
|
|
|
|
|
|
| |
Reviewed by: ru
Approved by: murray
Obtained from: OpenBSD
|
| |
|
|
|
|
|
|
|
|
| |
instead of #pragma weak to create weak definitions. This macro is
improperly named, though, since a weak definition is not the same
thing as a weak reference.
Suggested by: bde
|
| |
|
| |
|