summaryrefslogtreecommitdiff
path: root/lib/libc/stdio
AgeCommit message (Collapse)Author
2016-01-19remove a nop assignment that has been #if 0'd since 1996mmcc
ok millert@
2016-01-04Bugfix: When errno happens to be EILSEQ upon entry to fgetws(3),Ingo Schwarze
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@
2016-01-04Fix lots of bugs.Ingo Schwarze
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@
2015-12-28Remove NULL-checks before free() and a few related dead assignments.mmcc
ok and valuable input from millert@
2015-12-24Both our manual and POSIX ask us to set the error indicator when anIngo Schwarze
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@
2015-11-04replace setbuf with setvbuf, from Frederic NowakTed Unangst
2015-10-25Hide __atexit and __atexit_register_cleanup()Philip Guenther
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@
2015-10-13Sync printf family return value with ISO C which specifies thatTodd C. Miller
these functions return a negative value on failure. OK doug@ deraadt@
2015-10-07Be explicit that the user is responsible for freeing the line bufferTodd C. Miller
and show this in the example.
2015-10-04wrap _fwalk() so internal calls are direct (at least until we stopPhilip Guenther
exporting it)
2015-10-01Eliminate the last of the LINTEDn and PRINTFLIKEn comments. In onePhilip Guenther
case, by deleting some useless '& of an array' we also eliminate the need for the casts which prompted the original lint warnings ok deraadt@
2015-09-29Delete the final, inscrutable NOSTRICT and VARARGS lint commentsPhilip Guenther
ok millert@
2015-09-14in the SYNOPSIS, make void function arguments explicitIngo Schwarze
2015-09-14Wrap the remaining __*dtoa() functions so that internal calls go directPhilip Guenther
2015-09-13Wrap <stdlib.h> so that calls go direct and the symbols not in thePhilip Guenther
C standard are all weak. Apply __{BEGIN,END}_HIDDEN_DECLS to gdtoa{,imp}.h, hiding the arch-specific __strtorx, __ULtox_D2A, __strtorQ, __ULtoQ_D2A symbols.
2015-09-12Wrap <inttypes.h> and finish wrapping of <wchar.h> so that calls go directPhilip Guenther
and the symbols not in the C standard are weak
2015-09-12Wrap <unistd.h> so that internal calls go direct and they're all weak symbolsPhilip Guenther
Delete unused 'fd' argument from internal function oldttyname()
2015-09-10another missing MdocdateIngo Schwarze
2015-08-31Add framework for resolving (pun intended) libc namespace issues, usingPhilip Guenther
wrapper .h files and asm labels to let internal calls resolve directly and not be overridable or use the PLT. Then, apply that framework to most of the functions in stdio.h, string.h, err.h, and wchar.h. Delete the should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here. tests clean on i386, amd64, sparc64, powerpc, and mips64 naming feedback from kettenis@ and millert@ ok kettenis@
2015-08-27Use static and __{BEGIN,ENV}_HIDDEN_DECLS to hide a bunch of internalPhilip Guenther
symbols that are not longer exported. (This improves the generated code.) ok deraadt@
2015-08-20All these files include <stdlib.h>, so do not need to castTheo de Raadt
malloc/calloc/realloc* returns.
2015-06-03snprintf(3) is available on all modern systems and asprintf(3) isTodd C. Miller
available on more systems these days. OK deraadt@
2015-03-23fix memory leaks in tempnam(3) error pathsJonathan Gray
ok miod@ millert@ krw@ guenther@
2015-03-13remove the first comma from constructs like ", and," and ", or,": you can useJason McIntyre
"and" and "or" to join sentence clauses, and you can use commas, but both hinders reading;
2015-03-12Fix typo: nemb -> nmembLawrence Teo
From Ryan May.
2015-03-05Revert; committed by accident without approval from deraadt@ at releaseLawrence Teo
time. Prodded by guenther@. Sorry.
2015-03-05Fix typo, from Ryan May.Lawrence Teo
2015-02-28Reduce usage of predefined strings in manpages.Anthony J. Bentley
Predefined strings are not very portable across troff implementations, and they make the source much harder to read. Usually the intended character can be written directly. No output changes, except for two instances where the incorrect escape was used in the first place. tweaks + ok schwarze@
2015-02-06SIZE_MAX is standard, we should be using it in preference to theTodd C. Miller
obsolete SIZE_T_MAX. OK miod@ beck@
2015-02-05Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@Todd C. Miller
2015-01-29Use .Rv where appropriate, and move it to RETURN VALUES;Ingo Schwarze
remove .Tn, and a few minor macro adjustments. Patch from Kaspars at Bankovskis dot net.
2015-01-16Move to the <limits.h> universe.Theo de Raadt
review by millert, binary checking process with doug, concept with guenther
2015-01-15typo; from Kaspars at Bankovskis dot netIngo Schwarze
2015-01-13remove .Tn from stdio manuals; Kaspars Bankovskis found one of theseIngo Schwarze
2015-01-13Remove unnecessary calls to __atexit_register_cleanup(), calling __sinit()Philip Guenther
instead where necessary. Based on a diff from enh (at) google.com ok millert@
2015-01-12Add fgetwln(3) from FreeBSD and bump libc minor revision.Todd C. Miller
2015-01-05Remove #ifdef notdef bits--we are not going to change the fgetln()Todd C. Miller
API to NUL-terminate the buffer.
2014-12-21Show the sign for NaN as per POSIX; from Elliott Hughes.Daniel Dickman
ok martynas@, millert@, doug@
2014-12-08don't do silly (and slow) one byte reads in unbuffered mode.Ted Unangst
from enh at google
2014-11-26garbage collect .TnIngo Schwarze
2014-11-25zap trailing whitespace;Jason McIntyre
2014-11-25C99 says setvbuf() returns non-zero, not EOF. Also, POSIX documentsTodd C. Miller
that it returns an error for invalid mode which matches our behavior. OK jmc@ deraadt@
2014-11-25Move guts of setbuf.3 into setvbuf.3 to make it clear which oneTodd C. Miller
should be used in new code.
2014-11-19abort() doesn't call atexit handlers any morePhilip Guenther
2014-11-15Reduce instances of `` '' in manuals.Anthony J. Bentley
troff displays these as typographic quotes, but nroff implementations almost always print them literally, which rarely has the intended effect with modern fonts, even in stock xterm. These uses of `` '' can be replaced either with more semantic alternatives or with Dq, which prints typographic quotes in a UTF-8 locale (but will automatically fall back to `` '' in an ASCII locale). improvements and ok schwarze@
2014-11-04explicitly clarify that reading also stops after size-1 bytesTed Unangst
2014-10-31Use "const char tempchars[]" instead of "const char *tempchars".Todd C. Miller
Since tempchars is never reassigned there's no need to indirect through a pointer. Still getting used to this newfangled C89.
2014-10-26The open flags param to mkostemps() should be "flags" not "oflags"Todd C. Miller
for consistency with the rest of the manual.
2014-10-16Fix bounds check for newlen without relying on unspecified behavior.Todd C. Miller
OK deraadt@
2014-10-11use reallocarray, and avoid this << 1 ugliness.Theo de Raadt
ok doug