diff options
| author | Marek Brudka <mbrudka@aster.pl> | 2005-07-16 14:53:18 +0000 |
|---|---|---|
| committer | Marek Brudka <mbrudka@aster.pl> | 2005-07-16 14:53:18 +0000 |
| commit | b1d1d319bc6bd223e7d1b13b77462a966a481e36 (patch) | |
| tree | afbf668ac0272a024349699d6687691fb217eb59 /src/pj_malloc.c | |
| parent | 74b6f7bf37ffd75e4f92de5276929702518eb4df (diff) | |
| download | PROJ-b1d1d319bc6bd223e7d1b13b77462a966a481e36.tar.gz PROJ-b1d1d319bc6bd223e7d1b13b77462a966a481e36.zip | |
Quick bugfix to errno after malloc success problem.
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1302 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src/pj_malloc.c')
| -rw-r--r-- | src/pj_malloc.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pj_malloc.c b/src/pj_malloc.c index 6beb502a..a1dd162c 100644 --- a/src/pj_malloc.c +++ b/src/pj_malloc.c @@ -6,9 +6,21 @@ static const char SCCSID[]="@(#)pj_malloc.c 4.3 93/06/12 GIE REL"; ** projection system memory allocation/deallocation call with custom ** application procedures. */ #include <projects.h> +#include <errno.h> + void * pj_malloc(size_t size) { - return(malloc(size)); +// Currently, pj_malloc is a hack to solve an errno problem. +// The problem is described in more details at +// https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=86420. +// It seems, that pj_init and similar functions incorrectly +// (under debian/glibs-2.3.2) assume that pj_malloc resets +// errno after success. pj_malloc tries to mimic this. + int old_errno = errno; + void *res = malloc(size); + if ( res && !old_errno ) + errno = 0; + return res; } void pj_dalloc(void *ptr) { |
