summaryrefslogtreecommitdiff
path: root/libc/stdlib
AgeCommit message (Collapse)Author
2015-12-17libc/stdlib: canonicalize_file_name() memory leakWojciech Nizinski
Uclibc's canonicalize_file_name() is allocating temprary buffer of 4kB (PATH_MAX), and passing it to realpath() as second argument. Function is not checking if realpath() fails and memory is lost.
2015-12-09Make malloc_stats() GNU libc compatibleWaldemar Brodkorb
This fix commit 76dfc7ce8c "Some requested additional malloc entry points" from 2004's Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2015-08-14getenv: allow overwriting of functionWaldemar Brodkorb
This fixes static compile issues of sudo, because sudo uses it's own getenv implementation.
2015-08-14add mkstemps, mkstemps64 and mkostemps, mkostemps64 functionsRomain Naour
Change __gen_tempname() prototype in order to pass the additional suffix lenght. In __gen_tempname() add a new check for suffixlen. Update some comments in the code. Signed-off-by: Romain Naour <romain.naour@openwide.fr> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2015-04-13return NULL for realloc(p,0) like glibcWaldemar Brodkorb
See discussion here about the issue: https://sourceware.org/bugzilla/show_bug.cgi?id=12547 Fixes testsuite errors.
2015-04-12remove more of the link_warningsWaldemar Brodkorb
Only the stub warnings left for now.
2015-03-29merge uClibc git masterWaldemar Brodkorb
2015-03-22atexit_old: Do not add it to shared libcKhem Raj
atexit should only be in either uclibc_nonshared.a shared libc case or libc.a in static build case Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-18malloc-standard: Add locking to malloc_trimBernhard Reutner-Fischer
Closes bugzilla #4586 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-18malloc: checked_request2size failure deadlocksZhiqiang Zhang
For some rarely cases(almost App bugs), calling malloc with a very largre size, checked_request2size check will fail,set ENOMEM, and return 0 to caller. But this will let __malloc_lock futex locked and owned by the caller. In multithread circumstance, other thread calling malloc/calloc will NOT succeed and get locked. Signed-off-by: Zhiqiang Zhang <zhangzhiqiang.zhang@huawei.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-14Revert "resolve merge"Waldemar Brodkorb
This reverts commit 6b6ede3d15f04fe825cfa9f697507457e3640344.
2015-02-14resolve mergeWaldemar Brodkorb
2015-01-26merge upstream changesWaldemar Brodkorb
2015-01-23add argument check in setenv()Xishi Qiu
setenv() in glibc/eglibc will check the argument, like this, ... if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { __set_errno (EINVAL); return -1; } ... So add argument check in uclibc's setenv() too. Signed-off-by: Xishi Qiu <qiuxishi@huawei.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-22libc: Avoid redundant setting of ENOMEMBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-01remove unused Linux 2.0 compat code, otherwise c6x without NPTL is brokenWaldemar Brodkorb
2014-12-15mkostemp: fix implementationAnthony G. Basile
mkostemp(char *template, int flags) generates a unique temporary filename from a template. The flags parameter accepts three of the same flags as open(2): O_APPEND, O_CLOEXEC, and O_SYNC. The current implementation of mkostemp(3) does not respect the flags and in fact confuses the flags with the file mode which should always be S_IRUSR | S_IWUSR. This patch corrects this issue. Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-12-10mkostemp: fix implementationAnthony G. Basile
mkostemp(char *template, int flags) generates a unique temporary filename from a template. The flags parameter accepts three of the same flags as open(2): O_APPEND, O_CLOEXEC, and O_SYNC. The current implementation of mkostemp(3) does not respect the flags and in fact confuses the flags with the file mode which should always be S_IRUSR | S_IWUSR. This patch corrects this issue. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-20linuxthreads: remove unused s390 codeWaldemar Brodkorb
Cleanup linuxthreads by removing unused s390 code. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2014-09-16libc: silence missing prototype warningBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-28Revert "sparc: disable cancellable system, as it fails in strange ways right ↵Waldemar Brodkorb
now" This reverts commit 1db4f8f8389f6a935ecd83aff7fcce5d1cf2c0f3. It is unclear in which way this is breaking sparc systems. With this change added you get following linking error: libpthread/nptl/libpthread_so.a(pt-system.oS): In function `__libc_system': libc/stdlib/system.c:64: undefined reference to `__wait4_nocancel' Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-04add UCLIBC_SUSV2_LEGACY to hide vallocBernhard Reutner-Fischer
valloc was marked as LEGACY in SUSv2, removed from SUSv3 and later. TODO: Remove this (point people to memalign and it's successors?). Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-03stdlib: avoid relocationBernhard Reutner-Fischer
valloc uses memalign Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-11stdlib: Fix fndecl of mkostemp, mkostemp64Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05mman: rename MAP_UNINITIALIZE to MAP_UNINITIALIZEDBernhard Reutner-Fischer
The name was changed to include a trailing 'D' when it went into the kernel. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05buildsys: switch libc to kbuild-styleBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05libc: atexit: reuse free slots at the end of exit functions tableRonald Wahl
Continuosly dlopen and dlclose of shared object will cause a memory leak in atexit function. This fix reuse free slots at the end of the list. For further detail see https://bugs.busybox.net/show_bug.cgi?id=2455 Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com> Tested-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-11-29libc/stdlib: localize __unix_grantptMike Frysinger
When ASSUME_DEVPTS is disabled, we end up exporting __unix_grantpt and get a reloc to it from grantpt. Mark it static to fix all of that. Reported-by: Michael Deutschmann <michael@talamasca.ocis.net> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18drop support for pre ISO-C compilersMike Frysinger
This drops __signed, __volatile, and __const. Only the latter was used in the code base, and for uClibc, not consistently. Much of the code used plain "const" which meant "__const" was useless. Really, the point of this is to stay in sync with what glibc did. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18Replace FSF snail mail address with URLsMike Frysinger
This matches a similar change made to glibc. No functional changes here. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-14libc/stdlib: add mkostemp helpersMike Frysinger
Some projects (like udev) are starting to use this. Imported from glibc. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-06-15update arc4random from bug #885Peter S. Mazinger
Add config option to provide arc4random without device access. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15wait4.c: provide hidden __wait4_nocancel independent of any guardsPeter S. Mazinger
Correct wait4 guard (it is only __USE_BSD) wait3, system: use __wait4_nocancel Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15stdlib.c: remove comment about _Exit, it is provided in _exit.cPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15add lcong48[_r]Peter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15getpt.c: no need for hidden posix_openptPeter S. Mazinger
Prefer static inline instead of hidden (__bsd_getpt) Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15malloc.h: use sysconf(_SC_PAGESIZE) instead of __pagesizePeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15malloc.h: hide internal functions (mainly debug related)Peter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15malloc-simple: make _aligned_blocks static and __libc_free_aligned hiddenPeter S. Mazinger
move __libc_free_aligned prototype up to a common place. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15malloc: use uClibc_mutex.h provided macros consequentlyPeter S. Mazinger
use the __UCLIBC_MUTEX macros remove unused code remove duplicated code (likely,unlikely) hide internal __x() functions (mainly debug related) Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15memalign.c: does not use MAX, do not include param.hPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15do not define _ISOC99_SOURCE in specific filesPeter S. Mazinger
This should come properly from features.h or the build. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15remove duplicate prototypes for _stdio_term().Peter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15resolv.c,time.c,_atexit.c: hide 3 locksPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15arc4random.c: replace a commentPeter S. Mazinger
Remove pointer to a dead link. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15stdlib.h, arc4random.c: fix arc4random return type to u_int32_tPeter S. Mazinger
Change uint32_t to u_int32_t and uint8_t to u_int8_t, removing completely the dependency on stdint.h. Based on patch by Timo Teraes <timo.teras@iki.fi>. His comment: This also fixes a major bug that stdlib.h includes stdint.h. Things might go very wrong because stdint.h has conditional defines and if stdlib.h is included before #define's for stdint.h we end up missing things and breaking builds (e.g. openjdk). Signed-off-by: Timo Teraes <timo.teras@iki.fi> Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15arc4random.c: use smallint for rs_initializedPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15arc4random.c: move arc4_getbyte upPeter S. Mazinger
no need for forward declarations Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15stdlib.c: get rid of the compiler workarounds by using strong_alias_untypedPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15make __uClibc_fini() hiddenPeter S. Mazinger
No need for a visible version Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>