Age | Commit message (Collapse) | Author |
|
|
|
failure. This change brings fwscanf(3) back in line with fscanf(3).
From FreeBSD; ok deraadt@, millert@
|
|
string-handling <stdio.h> functions, like we already do it for <string.h>.
Includes a smaller patch from <kshe59 at zoho dot eu>, OK jmc@.
|
|
while here, consistently use .Fo to cure execessive line lengths
|
|
with "warning: " since 2003, so the messages themselves need not
contain the prefix anymore.
From Scott Cheloha
ok jca, deraadt
|
|
using mbrtowc(3). Thus, we now treat the format string as a bytestring,
not as a multibyte character string.
We think that ANSI C made a small error when adding wide characters:
The committees essentially replaced "characters" with "wide characters"
in the existing printf documentation, which was written before the
concept of processing was established. Doing processing on the format
string would break some 8-bit format strings in the wild, and that
isn't something these committees gave themselves license to do.
Based on the "10x printf speedup" commit from android found by tedu:
https://github.com/aosp-mirror/platform_bionic/commit/5305a4d4a723b06494b93f2df81733b83a0c46d3
Thanks to millert and schwarze for digging into the history and
testing *printf behavior on other platforms.
ok deraadt, millert
|
|
changes by schwarze to vfprintf.c r1.71. Cherrypicked from android:
https://github.com/aosp-mirror/platform_bionic/commit/5305a4d4a723b06494b93f2df81733b83a0c46d3
ok millert
|
|
|
|
|
|
ok schwarze@
|
|
2. point to getline (suggested by nicm@)
3. cross reference fgetc(3) rather than putc(3)
4. add missing error handling to the example code
OK nicm@
|
|
|
|
inspired by a similar change to fgetln.
ok deraadt millert
|
|
the string buffer used by asprintf() and vasprintf(). OK deraadt@
|
|
buffers. We don't bother doing this for objects containing pointers,
but focus on controllable data.
ok millert
|
|
we expanded the buffer to a single page. The final realloc() can
be expensive for large buffers and is not realled needed. OK deraadt@
|
|
nearest page instead of doubling the old size until it is large
enough. OK deraadt@
|
|
|
|
|
|
or prototypes. Ditto for some of the char* and void* casts too.
verified no change to instructions on ILP32 (i386) and LP64 (amd64)
ok natano@ abluhm@ deraadt@ millert@
|
|
OK schwarze@
|
|
Recommend POSIX getline(3) instead.
|
|
to determine the length instead of doing it manually. OK schwarze@
|
|
even though ferror(3) is already set;
also from Andrey Chernov <ache at freebsd dot org>;
OK millert@
|
|
and failed (setting errno and ferror(3)) both at the same time.
That's a bad idea in general, and here in particular since
returning partial lines was neither reliable (sometimes, you
got NULL anyway) nor predictable (almost always, the line would
be truncated long before the actual read error).
Instead, on read failure, fail properly and always return NULL.
Issue found in a discussion with Andrey Chernov <ache at freebsd dot org>
who finally agreed to move FreeBSD into the same direction.
The fix is joint work with and OK by millert@.
|
|
from Andrey Chernov <ache at freebsd dot org>;
OK millert@
|
|
OK jca@ martijn@ millert@
|
|
|
|
Over time we can repair software which performs this non-standard behaviour,
and fix bugs along the way. Let's first find out how bad the situation is
by deploying this in snapshots.
This type of logging is possible because OpenBSD syslog_r(3) -> sendsyslog(2)
is side-effect free enough to be used in the bowels of libc.
ok tedu
|
|
|
|
|
|
completion, just like puts(3). Found the hard way in portable code.
OK jmc@
|
|
ok deraadt@
|
|
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!
Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!
Clean up libpthread's symbol exports like libc.
On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.
Testing by various, particularly sthen@ and patrick@
ok kettenis@
|
|
data isn't necessary.
ok mpi@, ok&tweak natano@
|
|
ok sthen@
|
|
correctly - logically complete that now by removing MLINKS from base;
authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;
ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung
|
|
ok deraadt@, stsp@
|
|
idioms.
Adopt the more concise fcntl(n, F_GETFL) over fcntl(n, F_GETFL, 0)
where it is obvious further investigation will not yield and
even better way.
Obviousness evaluation and ok guenther@
|
|
okay jmc@
|
|
by POSIX and as FreeBSD, SunOS 10/11, and glibc also do it. Note
that an enquiry to the Austin Group led to the conclusion that this
change probably violates the C standard: C and POSIX unintentionally
conflict. But the POSIX behaviour makes more sense (easier to write
correct error handling code for it, and a lower risk that programs
miss errors) and is much more widespread, and the Austin Group
intends to approach the C committee in order to adjust the C standard.
See: http://austingroupbugs.net/view.php?id=1022
While here, do not set errno a second time, wcrtomb(3) already did that,
and it is required to do it by the standard.
OK millert@ and tedu@, and jca@ no longer objects
|
|
ok millert@
|
|
and when the file ends without a terminating Ln character,
fgetws(3) discarded any characters read and reported bogus EOF.
Never inspect errno(2) unless right after an error occurred!
OK millert@
|
|
1. When fprintf(fp, "...%ls...", ...) encounters an encoding error,
do not destroy all the fp->_flags, which made the file permanently
unreadable and unwriteable.
2. Do not change fp->_flags at all in case of encoding errors.
Neither the manual nor POSIX ask for it, no other conversions set the
error indicator, and it isn't needed because the return value reports
failure and must be checked anyway.
3. Detect failure in mbrtowc(3), do not silently treat invalid bytes
in the format string as the end of the format string.
4. Detect failure of __find_arguments(), no matter whether due to
out of memory conditions or encoding errors, and gracefully fail
rather than accessing an invalid pointer.
5. Remove the pointless and slightly dangerous errno = EILSEQ overrides
after functions that already do that and are required by the standard
to do so.
OK jca@ on items 1, 2, and 5.
OK millert@ on the complete diff.
"Completely brutal mix of bugs." deraadt@
|
|
ok and valuable input from millert@
|
|
encoding error occurs, so do it.
While here, do not set errno after mbrtowc(3) failure; mbrtowc(3)
already does that, and that behaviour is required by the standard.
ok jca@ guenther@ "nice find" deraadt@
|
|
|
|
Wrap __cxa_{atexit,finalize}() so the call from exit() goes direct
Switch regress/lib/libc/atexit/ to be built with -static so that it can
still access __atexit*
ok millert@ jca@
|
|
these functions return a negative value on failure.
OK doug@ deraadt@
|
|
and show this in the example.
|