[PATCH] portably set stream error flag in libbb/printf.c

Rob Landley rob at landley.net
Thu Mar 23 07:31:37 PST 2006


On Wednesday 22 March 2006 11:53 pm, Rich Felker wrote:
> libbb/printf.c fiddles with internals of the FILE structure to set the
> stream error flag when bb_*printf fails. This involves poking around
> in opaque data structures which requires separate code for every
> possible C library implementation, and it's not even guaranteed to
> work between different releases of the same implementation (in the
> worst case it results in unexpected memory corruption and catastrophic
> behavior if the internals change).
>
> This patch implements setting the stream error flag portably, in a way
> that should work on any remotely POSIX-compliant stdio implementation
> (anything that provides fileno() and that sets the error flag on
> failed putc).
>
> This is my first patch sent to the list rather than the bug tracker.
> Hopefully it's correct/acceptable for inclusion in BB. If not please
> let me know what I should change.
>
> -Rich (dalias from #uclibc/rfelker on the bugtracker)

Ooh, applied with extreme prejudice.  Svn 14627.  Thanks.

Rob

-- 
Never bet against the cheap plastic solution.


More information about the busybox mailing list