summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/reallocarray.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2016-03-21Plug a memory leak in vnet(4) ioctl code path.stsp1-3/+6
ok kettenis@
2016-03-21Merge a few simple fixes from NetBSD:schwarze1-6/+10
NetBSD rev. 1.68 2012/09/10 christos (bugfixes from Steffen Nurpmeso) * el_wgetc(): set el_errno after read_char() failure * el_wgets(): flag error condition after read_getcmd() failure NetBSD rev. 1.69 2012/09/11 christos (bugfix from Christos Zoulas) * read_getcmd(): return failure after el_wgetc() failure NetBSD rev. 1.75 2016/02/12 christos (cleanup from Christos Zoulas) * read_getcmd(): use a constant rather than a magical number
2016-03-21Handle kbind()'s third argument correctlyguenther1-1/+2
2016-03-20Cleanup of standard header inclusion:schwarze33-170/+178
1. Add the missing <errno.h> to sig.c. 2. Do not include standard headers from private headers "chared.h" and "el.h", include them directly where needed. 3. Delete a few needless inclusions of <ctype.h>. 4. Sort the standard headers. 5. Delete _GNU_SOURCE weirdness from histedit.h, that file doesn't even need the access to wcsdup(3) mentioned in the comment. 6. Delete some trailing blanks and blanks before tabs. OK czarkoff@
2016-03-20delete useless "typedef int bool_t", use int directly;schwarze2-7/+5
OK czarkoff@
2016-03-20Cleanup of private header inclusion:schwarze23-67/+61
1. Do not include private headers from "chared.h", "hist.h", "prompt.h", "refresh.h", "search.h", "sig.h", "terminal.h", "tty.h". The only private header having to include other private headers is "el.h". 2. Do not include "common.h", "parse.h", "help.h" from "el.h", and do not include "emacs.h" and "vi.h" from "chared.h", include them directly where needed. 3. Do include "fcns.h" from "el.h" because el_func_t is needed for "map.h". 4. Do not include private headers again that are already included by "el.h". 5. Include private headers after standard headers. OK czarkoff@
2016-03-20support WIDECHAR;schwarze1-1/+7
OK czarkoff@
2016-03-20Use getline(3) rather than fgetln(3) because it is standardizedschwarze4-42/+34
and simpler and safer to use. Implemented by Christos Zoulas following my suggestion, with a bug fix by me.
2016-03-20minor simplifactions, style fixes, and trivial syncs from NetBSDschwarze3-19/+18
2016-03-20syncderaadt1-26/+0
2016-03-20Fix the same bug again that was already fixed in:schwarze1-3/+5
OpenBSD tokenizer.c rev. 1.8 2003/08/11 18:21:40 deraadt Don't increase amax on realloc() failure. The original fix got lost in a merge along the way. This fix from Christos Zoulas via NetBSD tokenizer.c rev. 1.23 2016/02/15. OK czarkoff@
2016-03-20Delete the useless Int datatype and always use the standard wint_tschwarze17-173/+172
directly. This is not a problem because <wchar_t> is required all over the place anyway, even when WIDECHAR is not defined. No functional change except that it fixes a few printf(3) format string issues, %c vs. %lc. OK czarkoff@
2016-03-20Get rid of "#ifdef WIDECHAR" and one goto in read_char(),schwarze3-15/+24
making the code more readable. Instead, provide an mbrtowc(3) replacement function in chartype.[hc], files that encapsulate such system dependencies anyway. No functional change. OK czarkoff@
2016-03-20Delete the weird IGNORE_EXTCHARS flag, simplifying the codeschwarze3-16/+21
in the generic low-level function read_char(). Until we fully enable UTF-8 support, instead filter out non-ASCII characters in the more logical place in the high-level function el_gets(3). OK czarkoff@.
2016-03-20Fix the public interface function el_getc(3).schwarze2-11/+17
On OpenBSD, the effects are to set the return argument to the NUL byte in case of a read failure (for robustness) and to properly set errno when the character is out of range and cannot be stored in a byte. Once we enable UTF-8, this will be needed to avoid returning bogus bytes for valid Unicode characters. On systems where the internal representation of wchar_t doesn't match UCS-4, breakage was potentially even worse. OK czarkoff@.
2016-03-20Fix read_char() for the non-UTF-8 case, in particular for systemsschwarze1-5/+12
supporting other multibyte locales or having an internal representation of wchar_t that doesn't match UCS-4. No functional change on OpenBSD, but it makes the code less confusing. OK czarkoff@.
2016-03-20Fix the CHARSET_IS_UTF8 case in read_char().schwarze3-27/+45
For now, this mainly help programs explicitly using wide-character functions like el_wgetc(3) and el_wgets(3). 1. After reading an invalid byte sequence, do not throw away additional valid bytes; fix by me using mbrtowc(3), obsoleting utf8_islead(). 2. When read(2) returns EOF, return that information to the caller, do not prod on and potentially access garbage data in the buffer; from Linas Vepstas via NetBSD read.c rev. 1.70 2013/05/27. 3. After read__fixio() failure, restore errno to the one set by read(); from Steffen Nurpmeso via NetBSD read.c rev. 1.68 2012/09/10. 4. After read__fixio() success, restore errno to the initial state upon function entry; fix by me. OK czarkoff@. Also committed to NetBSD.
2016-03-20whitespace: remove a space before a tab and a trailing tab.tb1-3/+3
2016-03-20" the the " -> " the ", or in a couple of cases replace the superfluouskrw12-18/+18
"the" with the obviously intended word. Started with a "the the" spotted by Mihal Mazurek.
2016-03-20Update the axen driver to initialize the hardware on reset. Change was suggested by Takahiro Hayashi. Also lock the mii before performing the write, based on changes in NetBSD. While in there, remove the decaying eeprom code that has been commented out. This allows my adapter to attach reliably, ↵bmercer1-70/+6
pass traffic, and has not panic'd my machine when I unplug it. Test feedback and OK stsp@, and OK mpi@
2016-03-20Kill LOCALECHARSETS machinery, we only support ASCII and UTF-8 LC_CTYPEjca2-49/+8
Remove Makefile.inc and inline rules to produce LC_CTYPE for UTF-8. ok guenther@ stsp@
2016-03-20LOCALE_CHARSETS has been unused for some time nowjca2-10/+2
so no need to include share/locale/ctype/Makefile.inc to get it. ok guenther@ stsp@ (who had the same diff)
2016-03-20add include directories used by recent versions of libdrmjsg1-3/+7
2016-03-20__thrsleep.2 is contained in section 2natano1-3/+3
ok jmc
2016-03-20Update ticks in hardclock().uebayasi2-4/+3
OK mikeb@
2016-03-20Add regress for environ and __progname vs load-time .init functionsguenther7-1/+109
2016-03-20It's libpthread, not librthread, and __tfork(2) lets you set the TCBguenther1-9/+12
address of the new thread
2016-03-20syncderaadt17-17/+17
2016-03-20Add $OpenBSD lineguenther1-0/+1
2016-03-20Rearrange C runtime bits: now that ld.so exports environ and __progname,guenther32-171/+446
move their definitions and initialization in static links to libc.a Make crt0 always invoke a new func _csu_finish() in libc to process the auxv and to either register the ld.so cleanup function (in dynamic links) or initialize environ and __progname and do MC_DISABLE_KBIND (in static links). In libc, get pagesize from auxv; cache that between getpagesize() and sysconf(_SC_PAGESIZE) ok mpi@ "good time" deraadt@
2016-03-20Prepare for future ld.so/libc bump: update <tib.h> with the definitionsguenther2-57/+44
that will be needed and make libpthread work when ld.so/libc.a provide an initial TIB.
2016-03-20Export environ and __progname, making the latter a copy of just the filenameguenther12-51/+73
portion like crt0 does. This is prep for eliminating _dl_fixup_user_env() Mark almost everything in resolve.h as hidden, to improve code generation. ok kettenis@ mpi@ "good time" deraadt@
2016-03-20Use fcntl(fd, F_SETFL, flags) to clear O_NONBLOCK instead ofmillert1-4/+5
ioctl(fd, FIONBIO, ...). OK krw@
2016-03-20Revert, missing decl for in6_pcbaddrisavail() breaks kernel build.jca2-111/+107
Spotted by deraadt@
2016-03-20Currently we have about a 50/50 split over fcntl(n, F_GETFL [,0])krw9-31/+31
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@
2016-03-19Extract in6_pcbaddrisavail() from in6_pcbbind(), and use it whenvgross2-107/+111
checking for source availability in udp6_output(). Ok jca@ bluhm@
2016-03-19Add STANDARDS and HISTORY blurbs for SOCK_{NONBLOCK,CLOEXEC,DNS}guenther2-4/+36
2016-03-19This is thrkill, not __thrsigdivertguenther1-3/+3
2016-03-19Attach dwctwo(4) only on Octeon models that have a DWC2 controller.visa1-2/+13
OK uebayasi@
2016-03-19Turn off the close-on-exec bit with fcntl() instead of ioctl().krw2-7/+5
Remove some now useless "#include <ioctl.h>" lines. Inspired by & ok millert@
2016-03-19Do not run into sdgetdisklabel() when scsi disk is dying. Addbluhm1-4/+5
special error handling in sdopen() as temporary hack. OK krw@
2016-03-19Add regress tests for IPV6_PKTINFO with addrvgross2-0/+266
2016-03-19uio -> uiomove;jmc1-2/+2
2016-03-19Remove the unused flags argument from VOP_UNLOCK().natano59-272/+266
torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
2016-03-19Reduces the noise around the global ``ticks'' variable by renaming allmpi3-16/+16
local ones to ``nticks''. (missed in previous) ok stefan@, deraadt@
2016-03-19Reduces the noise around the global ``ticks'' variable by renamingmpi21-108/+108
all the local ones to ``nticks''. ok stefan@, deraadt@
2016-03-19Remove support for the XScale 80200. We don't use it, it didn't compilepatrick6-105/+21
and the included headers didn't even exist. ok jsg@
2016-03-19Remove support for IXP425. This is another architecture that is notpatrick6-59/+17
used and has probably never been used at all. Some included headers do not even exist. ok jsg@
2016-03-19Remove support for StrongARM (SA1) and IXP12x0. Both are ARMv4 andpatrick11-726/+29
are not used by any of the arm platforms. ok jsg@
2016-03-19By issuing :e +something in vi(1) this uncovers a backwards memcpy with themestre1-2/+2
code because the 2 buffers overlap and in order to solve it then replace memcpy(3) call by memmove(3) Issue noticed by Michael Price <michael at ectospheno dot com> who also tested this diff OK deraadt@