Skip to content

Commit

Permalink
cares: Support malloc(0) scenarios for AIX
Browse files Browse the repository at this point in the history
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: #6305
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-by: Michael Dawson <[email protected]>
  • Loading branch information
gireeshpunathil authored and Myles Borins committed Jun 2, 2016
1 parent bcd30df commit 9841dc4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions deps/cares/cares.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
[ 'OS=="aix"', {
'include_dirs': [ 'config/aix' ],
'sources': [ 'config/aix/ares_config.h' ],
'defines': [
# Support for malloc(0)
'_LINUX_SOURCE_COMPAT=1',
'_ALL_SOURCE=1'],
}],
['OS=="solaris"', {
'defines': [
Expand Down

0 comments on commit 9841dc4

Please sign in to comment.