summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio (follow)
Commit message (Collapse)AuthorAgeFilesLines
* When encoding fails in fputwc(3), set the error indicator as requiredschwarze2016-01-261-2/+2
| | | | | | | | | | | | | | | | 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
* remove a nop assignment that has been #if 0'd since 1996mmcc2016-01-191-5/+1
| | | | ok millert@
* Bugfix: When errno happens to be EILSEQ upon entry to fgetws(3),schwarze2016-01-041-3/+3
| | | | | | | 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@
* Fix lots of bugs.schwarze2016-01-041-18/+28
| | | | | | | | | | | | | | | | | | | | | 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@
* Remove NULL-checks before free() and a few related dead assignments.mmcc2015-12-284-32/+15
| | | | ok and valuable input from millert@
* Both our manual and POSIX ask us to set the error indicator when anschwarze2015-12-241-2/+2
| | | | | | | 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@
* replace setbuf with setvbuf, from Frederic Nowaktedu2015-11-043-9/+9
|
* Hide __atexit and __atexit_register_cleanup()guenther2015-10-251-3/+1
| | | | | | | | 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@
* Sync printf family return value with ISO C which specifies thatmillert2015-10-131-3/+3
| | | | | these functions return a negative value on failure. OK doug@ deraadt@
* Be explicit that the user is responsible for freeing the line buffermillert2015-10-071-4/+10
| | | | and show this in the example.
* wrap _fwalk() so internal calls are direct (at least until we stopguenther2015-10-042-2/+4
| | | | exporting it)
* Eliminate the last of the LINTEDn and PRINTFLIKEn comments. In oneguenther2015-10-012-5/+3
| | | | | | | case, by deleting some useless '& of an array' we also eliminate the need for the casts which prompted the original lint warnings ok deraadt@
* Delete the final, inscrutable NOSTRICT and VARARGS lint commentsguenther2015-09-292-4/+2
| | | | ok millert@
* in the SYNOPSIS, make void function arguments explicitschwarze2015-09-141-3/+3
|
* Wrap the remaining __*dtoa() functions so that internal calls go directguenther2015-09-141-5/+1
|
* Wrap <stdlib.h> so that calls go direct and the symbols not in theguenther2015-09-131-2/+2
| | | | | | 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.
* Wrap <inttypes.h> and finish wrapping of <wchar.h> so that calls go directguenther2015-09-121-2/+1
| | | | and the symbols not in the C standard are weak
* Wrap <unistd.h> so that internal calls go direct and they're all weak symbolsguenther2015-09-121-1/+3
| | | | Delete unused 'fd' argument from internal function oldttyname()
* another missing Mdocdateschwarze2015-09-101-2/+2
|
* Add framework for resolving (pun intended) libc namespace issues, usingguenther2015-08-3185-100/+174
| | | | | | | | | | | | 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@
* Use static and __{BEGIN,ENV}_HIDDEN_DECLS to hide a bunch of internalguenther2015-08-274-8/+16
| | | | | | symbols that are not longer exported. (This improves the generated code.) ok deraadt@
* All these files include <stdlib.h>, so do not need to castderaadt2015-08-203-6/+6
| | | | malloc/calloc/realloc* returns.
* snprintf(3) is available on all modern systems and asprintf(3) ismillert2015-06-031-6/+4
| | | | available on more systems these days. OK deraadt@
* fix memory leaks in tempnam(3) error pathsjsg2015-03-231-5/+6
| | | | ok miod@ millert@ krw@ guenther@
* remove the first comma from constructs like ", and," and ", or,": you can usejmc2015-03-131-3/+3
| | | | | "and" and "or" to join sentence clauses, and you can use commas, but both hinders reading;
* Fix typo: nemb -> nmemblteo2015-03-121-3/+3
| | | | From Ryan May.
* Revert; committed by accident without approval from deraadt@ at releaselteo2015-03-051-2/+2
| | | | time. Prodded by guenther@. Sorry.
* Fix typo, from Ryan May.lteo2015-03-051-3/+3
|
* Reduce usage of predefined strings in manpages.bentley2015-02-282-7/+7
| | | | | | | | | | | 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@
* SIZE_MAX is standard, we should be using it in preference to themillert2015-02-061-2/+3
| | | | obsolete SIZE_T_MAX. OK miod@ beck@
* Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@millert2015-02-052-4/+4
|
* Use .Rv where appropriate, and move it to RETURN VALUES;schwarze2015-01-291-8/+3
| | | | | remove .Tn, and a few minor macro adjustments. Patch from Kaspars at Bankovskis dot net.
* Move to the <limits.h> universe.deraadt2015-01-163-10/+10
| | | | review by millert, binary checking process with doug, concept with guenther
* typo; from Kaspars at Bankovskis dot netschwarze2015-01-151-4/+4
|
* remove .Tn from stdio manuals; Kaspars Bankovskis found one of theseschwarze2015-01-137-50/+28
|
* Remove unnecessary calls to __atexit_register_cleanup(), calling __sinit()guenther2015-01-132-4/+9
| | | | | | | instead where necessary. Based on a diff from enh (at) google.com ok millert@
* Add fgetwln(3) from FreeBSD and bump libc minor revision.millert2015-01-123-8/+206
|
* Remove #ifdef notdef bits--we are not going to change the fgetln()millert2015-01-051-13/+3
| | | | API to NUL-terminate the buffer.
* Show the sign for NaN as per POSIX; from Elliott Hughes.daniel2014-12-212-8/+6
| | | | ok martynas@, millert@, doug@
* don't do silly (and slow) one byte reads in unbuffered mode.tedu2014-12-081-1/+16
| | | | from enh at google
* garbage collect .Tnschwarze2014-11-261-8/+4
|
* zap trailing whitespace;jmc2014-11-251-2/+2
|
* C99 says setvbuf() returns non-zero, not EOF. Also, POSIX documentsmillert2014-11-252-10/+37
| | | | | that it returns an error for invalid mode which matches our behavior. OK jmc@ deraadt@
* Move guts of setbuf.3 into setvbuf.3 to make it clear which onemillert2014-11-253-117/+191
| | | | should be used in new code.
* abort() doesn't call atexit handlers any moreguenther2014-11-191-2/+2
|
* Reduce instances of `` '' in manuals.bentley2014-11-152-7/+12
| | | | | | | | | | | | 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@
* explicitly clarify that reading also stops after size-1 bytestedu2014-11-041-3/+5
|
* Use "const char tempchars[]" instead of "const char *tempchars".millert2014-10-311-2/+2
| | | | | Since tempchars is never reassigned there's no need to indirect through a pointer. Still getting used to this newfangled C89.
* The open flags param to mkostemps() should be "flags" not "oflags"millert2014-10-261-3/+3
| | | | for consistency with the rest of the manual.
* Fix bounds check for newlen without relying on unspecified behavior.millert2014-10-161-4/+3
| | | | OK deraadt@