summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
AgeCommit message (Collapse)Author
2016-03-17properly guard to macrosmmcc
ok otto@
2016-03-14small step towards multiple pools: move two globls into the struct dir_infoOtto Moerbeek
ok @stefan armani@
2016-03-13environ and __progname are not declared in a public header; declare themPhilip Guenther
in libc's hidden/stdlib.h instead of in each .c file that needs one ok deraadt@ gsoares@ mpi@
2016-03-12Remove sentences in RETURN VALUES sections saying that functions withmmcc
void return types 'return no value'. This is obvious and therefore unneccessary to mention. We spare rewind(3)'s sentence because espie@ pointed out that it's a warning - the function masks a potential error. This commit also adds a sentence to X509_free clarifying that it's NULL-safe. This bit was discussed with doug@. ok martijn@, sentiment supported by schwarze@
2016-02-25refactor option letter parsing into a subfunction, to increase clarityTheo de Raadt
about which options are turned on/off by 's' and 'S' ok tedu
2016-02-07compare pointer to NULL in example codemmcc
2016-02-05be more forceful about not using these.Marc Espie
improvements sthen@, jmc@. okay millert@, jca@ jmc@
2016-02-05Fix err(3) calls after allocation failures in examples.Ingo Schwarze
There is long-standing consensus that err(1, NULL) is the best idiom after failure of malloc(3) and friends. Quirk in the manual noticed by tb@.
2016-01-26Don't crash dumping malloc stats if malloc_init hasn't been called, noted byOtto Moerbeek
David CARLIER
2016-01-06Long ago, malloc internally had two kinds of failures, warnings and errors.Ted Unangst
The 'A' option elevated warnings to errors, and has been the default for some time. Then warnings were effectively eliminated in favor of everything being an error, but then the 'a' flag turned real errors into warnings! Remove the 'a' option entirely. You shouldn't have used it anyway. ok tb tdeval
2016-01-04Follow style(9) and drop lint /* NOTREACHED */ annotations fromtb
the examples. Diff from Juuso Lapinlampi < wub () partyvan ! eu >, thanks! ok schwarze@
2015-12-30another case where bad things would happen after wrterrorTed Unangst
2015-12-30if somebody makes the mistake of disabling abort, don't deref null inTed Unangst
validate_junk. from Michal Mazurek
2015-12-28Remove NULL-checks before free() and a few related dead assignments.mmcc
ok and valuable input from millert@
2015-12-27remove unused variableCharles Longeau
ok tedu@
2015-12-18Simplify return call of rand() and rand_r() to make it easier to read.tb
This is slightly less robust, but RAND_MAX must be one below a power of two in both variants anyway. Based on a suggestion by Matthew Martin. ok tedu@
2015-12-10tiny sanity check on file sizeTed Unangst
2015-12-09Integrate two patches originally from Daniel Micay.Ted Unangst
1. Optionally add random "canaries" to the end of an allocation. This requires increasing the internal size of the allocation slightly, which probably results in a large effective increase with current power of two sizing. Therefore, this option is only enabled via 'C'. 2. When writing junk (0xdf) to freed chunks (current default behavior), check that the junk is still intact when finally freeing the delayed chunk to catch some potential use after free. This should be pretty cheap so there's no option to control it separately. ok deraadt tb
2015-11-30change Xrs from now-defunct db(3) to dbopen(3); this wasn;t aJason McIntyre
straight replace: thanks both to schwarze and maja for feedback on how to rewrite parts; i've snuck in an rcs id->openbsd id change in dev_mkdb too;
2015-11-25Wrap <icdb.h> so that calls go direct and the symbols are all weakPhilip Guenther
ok tedu@
2015-11-24Don't fake a bulleted list by prefixing items with 'o'.Anthony J. Bentley
ok jmc@
2015-11-18add a version field to prevent mayhem if different data gets storedTed Unangst
2015-11-18update for new symbols and codeTed Unangst
2015-11-18Add icdb, the internal c database. A simpler replacement for the oldTed Unangst
Berzerkeley DB code.
2015-11-10update NAME section to include all documented functions,Jason McIntyre
or otherwise change Dt to reflect the name of an existing function; feedback/ok schwarze
2015-11-10libc.so can't be unloaded, so move the hidden atexit() and pthread_atfork()Philip Guenther
stubs for the executable from crtbegin.o into libc, which lets them be excluded from static links that don't use them. For this, drop the normal crt{begin,end}S.o from libc.so: the .init and .fini sections for libc aren't called at the right times anyway, so it's good that they're unused. libc.so just needs __guard_local and the .note.openbsd.ident section, so add them to stack_protector.c for now (this will be improved) "good time" deraadt@
2015-10-25Move the _atfork_list definition to atexit.c so that the fork syscall stubPhilip Guenther
doesn't get pulled into all static executables ok millert@ jca@
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-25Use sigaction() instead of signal() to avoid pulling in unnecessaryPhilip Guenther
wrappers. To keep uses from crawling back in, mark signal() as deprecated inside libc. ok deraadt@
2015-10-23Loop the waitpid() on EINTR, and save and restore the disposition ofPhilip Guenther
SIGINT and SIGQUIT with sigaction() instead of signal() so that all bits are preserved. ok deraadt@ millert@
2015-10-23Merge the sigaction() and sigprocmask() overloads/wrappers from libpthreadPhilip Guenther
into libc, and move pthread_sigmask() as well (just a trivial wrapper). This provides consistent handling of SIGTHR between single- and multi-threaded programs and is a step in the merge of all the libpthread overloads, providing some ASM and Makefile bits that the other wrappers will need. ok deraadt@ millert@
2015-10-13In rev 1.15 the sizeof argument was fixed in a strlcat() call butTodd C. Miller
the truncation check immediately following it was not updated to match. Not an issue in practice since the buffers are the same size. OK deraadt@
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-26lint is dead: delete useless LINTLIBRARY commentsPhilip Guenther
ok millert@
2015-09-19Don't wrap initialized variables: binutils appears to be mishandling themPhilip Guenther
on arm and m88k problems with optind observed by jsg@
2015-09-14Only two of the *rand48.c files need <math.h>, so just #include it in themPhilip Guenther
2015-09-14use .Va for global variables, and .Vt where the type is includedIngo Schwarze
2015-09-14Remove cast of int* to int*Philip Guenther
2015-09-13For now, permit overriding of the malloc family, to make emacs happyPhilip Guenther
2015-09-13Overshot w/PROTO_DEPRECATED: seed48_deterministic() is used internallyPhilip 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 <getopt.h> to make the functions weak and make access to the initializedPhilip Guenther
variables go direct. (Common variables cannot be aliased.)
2015-09-10Pull in namespace.h when building all .c files using gcc's -include option,Philip Guenther
so that we can provide asm labels for the memcpy/memset/__stack_smash_handler calls that it generates ab initio. Eliminate direct #includes of it. Make sure it's a dependency of all objects (unnecessary for asm, but close enough). ok deraadt@
2015-09-10reduce .Nd to one line and kill .Tn while hereIngo Schwarze
2015-09-10missing commas at the end of .Nm lines in the NAME sectionIngo Schwarze
2015-08-27Move the __rand48_* declarations into rand48.h, and then hide both themPhilip Guenther
and __dorand48() and __rand48_deterministic ok deraadt@
2015-08-20All these files include <stdlib.h>, so do not need to castTheo de Raadt
malloc/calloc/realloc* returns.
2015-06-21Just return if nmemb is 0. Avoids a NULL dereference and isTodd C. Miller
consistent with the behavior of the other libc sort functions. OK deraadt@
2015-05-12Add dlclose(3) to SEE ALSOPhilip Guenther
ok millert@ jmc@ schwarze@