| Commit message (Expand) | Author | Age | Files | Lines |
| * | fix uninitialized var in vfwprintf printing 0-prec string•••this could lead to spurious failures of wide printf functions
| Rich Felker | 2012-05-04 | 1 | -1/+1 |
| * | fix really bad breakage in strtol, etc.: failure to accept leading spaces | Rich Felker | 2012-04-19 | 1 | -1/+1 |
| * | fix wide scanf's handling of input failure on %c, and simplify %[ | Rich Felker | 2012-04-17 | 1 | -5/+6 |
| * | fix failure to distinguish input/match failure in wide %[ scanf•••this also includes a related fix for vswscanf's read function, which
was returning a spurious (uninitialized) character for empty strings.
| Rich Felker | 2012-04-17 | 2 | -2/+4 |
| * | fix over-read in %ls with non-wide scanf | Rich Felker | 2012-04-17 | 1 | -0/+1 |
| * | fix broken %s and %[ with no width specifier in wide scanf | Rich Felker | 2012-04-17 | 1 | -3/+7 |
| * | make wide scanf %[ respect width | Rich Felker | 2012-04-17 | 1 | -2/+3 |
| * | fix wide scanf to respect field width for strings | Rich Felker | 2012-04-17 | 1 | -4/+7 |
| * | fix some bugs in scanf %[ handling detected while writing the wide version | Rich Felker | 2012-04-17 | 1 | -4/+4 |
| * | introduce new wide scanf code and remove the last remnants of old scanf•••at this point, strto* and all scanf family functions are using the new
unified integer and floating point parser/converter code.
the wide scanf is largely a wrapper for ordinary byte-based scanf;
since numbers can only contain ascii characters, only strings need to
be handled specially.
| Rich Felker | 2012-04-17 | 4 | -524/+312 |
| * | avoid depending on POSIX symbol in code used from plain C functions | Rich Felker | 2012-04-17 | 1 | -1/+3 |
| * | avoid null pointer dereference on %*p fields in scanf | Rich Felker | 2012-04-17 | 1 | -1/+1 |
| * | also ensure that write buffer is bounded when __stdio_write returns•••assuming other code is correct, this should be a no-op, but better to
be safe...
| Rich Felker | 2012-04-17 | 1 | -0/+1 |
| * | fix buffer overflow in vfprintf on long writes to unbuffered files•••vfprintf temporarily swaps in a local buffer (for the duration of the
operation) when the target stream is unbuffered; this both simplifies
the implementation of functions like dprintf (they don't need their
own buffers) and eliminates the pathologically bad performance of
writing the formatted output with one or more write syscalls per
formatting field.
in cases like dprintf where we are dealing with a virgin FILE
structure, everything worked correctly. however for long-lived files
(like stderr), it's possible that the buffer bounds were already set
for the internal zero-size buffer. on the next write, __stdio_write
would pick up and use the new buffer provided by vfprintf, but the
bound (wend) field was still pointing at the internal zero-size
buffer's end. this in turn allowed unbounded writes to the temporary
buffer.
| Rich Felker | 2012-04-17 | 1 | -1/+2 |
| * | fix %lf, etc. with printf•••the l prefix is redundant/no-op with printf, since default promotions
always promote floats to double; however, it is valid, and printf was
wrongly rejecting it.
| Rich Felker | 2012-04-16 | 1 | -0/+2 |
| * | new scanf implementation and corresponding integer parser/converter•••advantages over the old code:
- correct results for floating point (old code was bogus)
- wide/regular scanf separated so scanf does not pull in wide code
- well-defined behavior on integers that overflow dest type
- support for %[a-b] ranges with %[ (impl-defined by widely used)
- no intermediate conversion of fmt string to wide string
- cleaner, easier to share code with strto* functions
- better standards conformance for corner cases
the old code remains in the source tree, as the wide versions of the
scanf-family functions are still using it. it will be removed when no
longer needed.
| Rich Felker | 2012-04-16 | 3 | -30/+343 |
| * | fix scanf handling of "0" (followed by immediate EOF) with "%x"•••other cases with %x were probably broken too.
I would actually like to go ahead and replace this code in scanf with
calls to the new __intparse framework, but for now this calls for a
quick and unobtrusive fix without the risk of breaking other things.
| Rich Felker | 2012-03-13 | 1 | -11/+6 |
| * | make stdio open, read, and write operations cancellation points•••it should be noted that only the actual underlying buffer flush and
fill operations are cancellable, not reads from or writes to the
buffer. this behavior is compatible with POSIX, which makes all
cancellation points in stdio optional, and it achieves the goal of
allowing cancellation of a thread that's "stuck" on IO (due to a
non-responsive socket/pipe peer, slow/stuck hardware, etc.) without
imposing any measurable performance cost.
| Rich Felker | 2012-02-02 | 3 | -5/+28 |
| * | simplify atexit and fflush-on-exit handling | Rich Felker | 2011-10-14 | 1 | -1/+4 |
| * | don't crash on null strings in printf•••passing null pointer for %s is UB but lots of broken programs do it anyway
| Rich Felker | 2011-09-28 | 1 | -1/+1 |
| * | avoid setting FILE lock count when not using flockfile•••for now this is just a tiny optimization, but later if we support
cancellation from __stdio_read and __stdio_write, it will be necessary
for the recusrive lock count to be zero in order for these functions
to know they are responsible for unlocking the FILE on cancellation.
| Rich Felker | 2011-09-21 | 1 | -1/+1 |
| * | more fmemopen null termination fixes•••null termination is only added when current size grows.
in update modes, null termination is not added if it does not fit
(i.e. it is not allowed to clobber data).
these rules make very little sense, but that's how it goes..
| Rich Felker | 2011-09-04 | 1 | -2/+3 |
| * | fix some fmemopen behaviors•••read should not be allowed past "current size".
append mode should write at "current size", not buffer size.
null termination should not be written except when "current size" grows.
| Rich Felker | 2011-09-04 | 1 | -4/+7 |
| * | fmemopen: fix eof handling, hopefully right this time | Rich Felker | 2011-09-04 | 1 | -3/+4 |
| * | fmemopen fixes•••disallow seek past end of buffer (per posix)
fix position accounting to include data buffered for read
don't set eof flag when no data was requested
| Rich Felker | 2011-09-04 | 1 | -1/+3 |
| * | memstreams: fix incorrect handling of file pos > current size•••the addition is safe and cannot overflow because both operands are
positive when considered as signed quantities.
| Rich Felker | 2011-09-04 | 2 | -4/+4 |
| * | optimize seek function for memory streams | Rich Felker | 2011-09-04 | 2 | -24/+6 |
| * | fix twos complement overflow bug in mem streams boundary check•••the expression -off is not safe in case off is the most-negative
value. instead apply - to base which is known to be non-negative and
bounded within sanity.
| Rich Felker | 2011-09-04 | 2 | -2/+2 |
| * | implement fmemopen•••testing so far has been minimal. may need further work.
| Rich Felker | 2011-09-03 | 1 | -18/+66 |
| * | fix some length calculations in memory streams | Rich Felker | 2011-09-03 | 2 | -3/+3 |
| * | implement open_wmemstream•••not heavily tested, but it seems to be correct, including the odd
behavior that seeking is in terms of wide character count. this
precludes any simple buffering, so we just make the stream unbuffered.
| Rich Felker | 2011-09-03 | 1 | -0/+95 |
| * | implement open_memstream•••this is the first attempt, and may have bugs. only minimal testing has
been performed.
| Rich Felker | 2011-09-03 | 1 | -0/+94 |
| * | fix crash in dns code with new stdio locking code | Rich Felker | 2011-08-01 | 1 | -0/+1 |
| * | add proper fuxed-based locking for stdio•••previously, stdio used spinlocks, which would be unacceptable if we
ever add support for thread priorities, and which yielded
pathologically bad performance if an application attempted to use
flockfile on a key file as a major/primary locking mechanism.
i had held off on making this change for fear that it would hurt
performance in the non-threaded case, but actually support for
recursive locking had already inflicted that cost. by having the
internal locking functions store a flag indicating whether they need
to perform unlocking, rather than using the actual recursive lock
counter, i was able to combine the conditionals at unlock time,
eliminating any additional cost, and also avoid a nasty corner case
where a huge number of calls to ftrylockfile could cause deadlock
later at the point of internal locking.
this commit also fixes some issues with usage of pthread_self
conflicting with __attribute__((const)) which resulted in crashes with
some compiler versions/optimizations, mainly in flockfile prior to
pthread_create.
| Rich Felker | 2011-07-30 | 14 | -39/+44 |
| * | eliminate dependence of perror on printf | Rich Felker | 2011-07-30 | 1 | -10/+5 |
| * | fix logic error in fread•••fread was calling f->read without checking that the file was in
reading mode. this could:
1. crash, if f->read was a null pointer
2. cause unwanted blocking on a terminal already at eof
3. allow reading on a write-only file
| Rich Felker | 2011-07-16 | 1 | -6/+1 |
| * | printf: "if a precision is specified, the '0' flag shall be ignored." | Rich Felker | 2011-07-04 | 1 | -1/+1 |
| * | zero precision with zero value should not inhibit prefix/width printing | Rich Felker | 2011-07-04 | 1 | -1/+4 |
| * | printf("%#x",0) should print 0 not 0x0 | Rich Felker | 2011-07-04 | 1 | -1/+1 |
| * | fix logic in __fwriting | Rich Felker | 2011-06-30 | 1 | -1/+1 |
| * | add and consolidate nasty stdio_ext junk•••hopefully this resolves the rest of the issues with hideously
nonportable hacks in programs that use gnulib.
| Rich Felker | 2011-06-30 | 3 | -17/+57 |
| * | implement the nonstandard GNU function fpurge•••this is a really ugly and backwards function, but its presence will
prevent lots of broken gnulib software from trying to define its own
version of fpurge and thereby failing to build or worse.
| Rich Felker | 2011-06-30 | 1 | -0/+11 |
| * | avoid 64bit warnings when using pointers as entropy for temp names | Rich Felker | 2011-06-13 | 2 | -2/+4 |
| * | fix the last known rounding bug in floating point printing•••the observed symptom was that the code was incorrectly rounding up
1.0625 to 1.063 despite the rounding mode being round-to-nearest with
ties broken by rounding to even last place. however, the code was just
not right in many respects, and i'm surprised it worked as well as it
did. this time i tested the values that end up in the variables round,
small, and the expression round+small, and all look good.
| Rich Felker | 2011-05-11 | 1 | -3/+4 |
| * | reduce some ridiculously large spin counts•••these should be tweaked according to testing. offhand i know 1000 is
too low and 5000 is likely to be sufficiently high. consider trying to
add futexes to file locking, too...
| Rich Felker | 2011-05-06 | 1 | -1/+1 |
| * | fix fclose return status logic, again•••the previous fix was incorrect, as it would prevent f->close(f) from
being called if fflush(f) failed. i believe this was the original
motivation for using | rather than ||. so now let's just use a second
statement to constrain the order of function calls, and to back to
using |.
| Rich Felker | 2011-05-02 | 1 | -1/+2 |
| * | fix undefined call order in fclose, possible lost output depending on compiler•••pcc turned up this bug by calling f->close(f) before fflush(f),
resulting in lost output and error on flush.
| Rich Felker | 2011-05-01 | 1 | -1/+1 |
| * | minor optimization in puts: use inline putc_unlocked macro for newline | Rich Felker | 2011-05-01 | 1 | -1/+1 |
| * | fix 2 eof-related bugs in scanf•••1. failed match of literal chars from the format string would always
return matching failure rather than input failure at eof, leading to
infinite loops in some programs.
2. unread of eof would wrongly adjust the character counts reported by
%n, yielding an off-by-one error.
| Rich Felker | 2011-04-25 | 1 | -3/+4 |
| * | clean up handling of thread/nothread mode, locking | Rich Felker | 2011-04-17 | 2 | -5/+1 |