Browse Source

cares: Support malloc(0) scenarios for AIX

Many places in cares library, when the stream data arrives
from the network with respect to dns and reverse dns
resolution, they are populated into data structures created
dymaically based on the size of the data. Malloc is heavily
used for such cases.

Often, based on the data length, malloc(0) is invoked. Linux
behavior on zero byte allocation is to return a valid pointer
where in AIX, it always return NULL.

This manifestst as test failure of test/internet/test-dns.js

Solution is to build cares with Linux compatible malloc behavior

PR-URL: https://github.com/nodejs/node/pull/6305
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
v4.x
Gireesh Punathil 9 years ago
committed by Myles Borins
parent
commit
6dfe7aeed5
  1. 4
      deps/cares/cares.gyp

4
deps/cares/cares.gyp

@ -12,6 +12,10 @@
[ 'OS=="aix"', { [ 'OS=="aix"', {
'include_dirs': [ 'config/aix' ], 'include_dirs': [ 'config/aix' ],
'sources': [ 'config/aix/ares_config.h' ], 'sources': [ 'config/aix/ares_config.h' ],
'defines': [
# Support for malloc(0)
'_LINUX_SOURCE_COMPAT=1',
'_ALL_SOURCE=1'],
}], }],
['OS=="solaris"', { ['OS=="solaris"', {
'defines': [ 'defines': [

Loading…
Cancel
Save