summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* include float.h for the LDBL_MAX_EXP cpp test in floatio.hjsg2016-10-302-2/+4
|
* Delete casts to off_t and size_t that are implied by assignmentsguenther2016-09-2114-42/+39
| | | | | | | 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@
* Store the return value of mbrtowc() in a size_t, not int.millert2016-08-291-13/+15
| | | | OK schwarze@
* Stop recommending the non-standard and slightly dangerous fgetln(3).schwarze2016-08-271-4/+4
| | | | Recommend POSIX getline(3) instead.
* When a precision is specified for a string format use strnlen()millert2016-08-271-17/+7
| | | | to determine the length instead of doing it manually. OK schwarze@
* improve revision 1.2: in unusual cases, fgetwc(3) can succeedschwarze2016-08-271-2/+12
| | | | | | even though ferror(3) is already set; also from Andrey Chernov <ache at freebsd dot org>; OK millert@
* After read errors, fgetln(3) sometimes succeeded (returning non-NULL)schwarze2016-08-251-3/+6
| | | | | | | | | | | | 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@.
* set the error indicator on malloc(3) failure;schwarze2016-08-241-2/+4
| | | | | from Andrey Chernov <ache at freebsd dot org>; OK millert@
* bugfix: when fgetwc(3) fails, fgetwln(3) must fail as well;schwarze2016-08-211-2/+2
| | | | OK jca@ martijn@ millert@
* % is escaped with more %, not backslash.tedu2016-08-172-6/+6
|
* Generate syslog warnings for %s fmt strings NULL to "(null)" conversions.deraadt2016-08-172-5/+38
| | | | | | | | | | | 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
* Add ERRORS section, from FreeBSD. OK tedu@millert2016-06-061-2/+17
|
* Return EOVERFLOW, not ENOMEM for overflow conditions to match POSIX.millert2016-06-061-3/+3
|
* fputs(3) now returns a non-negative number (as opposed to 0) on successfulmillert2016-05-261-10/+8
| | | | | completion, just like puts(3). Found the hard way in portable code. OK jmc@
* Make _fwalk and _cleanup completely internal to libcguenther2016-05-232-6/+3
| | | | ok deraadt@
* Use a Thread Information Block in both single and multi-threaded programs.guenther2016-05-072-27/+24
| | | | | | | | | | | | | | | | | 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@
* Prefer _MUTEX_*LOCK over _THREAD_PRIVATE_MUTEX_*LOCK() when thread-specificguenther2016-04-051-9/+9
| | | | | | data isn't necessary. ok mpi@, ok&tweak natano@
* get* can change *lineptr on failureguenther2016-04-041-2/+6
| | | | ok sthen@
* for some time now mandoc has not required MLINKS to functionjmc2016-03-301-34/+1
| | | | | | | | | | | | 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
* fix typo: "prefer seek()" -> "prefer fseek()"tb2016-03-261-3/+3
| | | | ok deraadt@, stsp@
* Currently we have about a 50/50 split over fcntl(n, F_GETFL [,0])krw2016-03-201-2/+2
| | | | | | | | | | 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@
* remind people rewind is seldom a good choiceespie2016-03-151-2/+5
| | | | okay jmc@
* 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
|