Skip to content

Commit

Permalink
OTP 18.3 fix, replaced erl_exit with a local version
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyrog committed May 9, 2016
1 parent 192f051 commit 830c80c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions c_src/afunix_drv.c
Expand Up @@ -768,8 +768,14 @@ static const struct in6_addr in6addr_loopback =
# endif /* ! HAVE_DECL_IN6ADDR_LOOPBACK */
#endif /* HAVE_IN6 */

/* XXX: is this a driver interface function ??? */
void erl_exit(int n, char*, ...);
static void fatal_exit(int n, char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
exit(n);
}

/*
* Malloc wrapper,
Expand All @@ -782,15 +788,15 @@ void erl_exit(int n, char*, ...);
static void *alloc_wrapper(ErlDrvSizeT size){
void *ret = driver_alloc(size);
if(ret == NULL)
erl_exit(1,"Out of virtual memory in malloc (%s)", __FILE__);
fatal_exit(1,"Out of virtual memory in malloc (%s)", __FILE__);
return ret;
}
#define ALLOC(X) alloc_wrapper(X)

static void *realloc_wrapper(void *current, ErlDrvSizeT size){
void *ret = driver_realloc(current,size);
if(ret == NULL)
erl_exit(1,"Out of virtual memory in realloc (%s)", __FILE__);
fatal_exit(1,"Out of virtual memory in realloc (%s)", __FILE__);
return ret;
}
#define REALLOC(X,Y) realloc_wrapper(X,Y)
Expand Down Expand Up @@ -2846,8 +2852,8 @@ static ErlDrvSSizeT inet_fill_opts(inet_descriptor* desc,
do { \
ErlDrvSizeT new_need = ((Ptr) - (*dest)) + (Size); \
if (new_need > dest_used) { \
erl_exit(1,"Internal error in inet_drv, " \
"miscalculated buffer size"); \
fatal_exit(1,"Internal error in inet_drv, " \
"miscalculated buffer size"); \
} \
dest_used = new_need; \
} while(0)
Expand Down

0 comments on commit 830c80c

Please sign in to comment.