Skip to content

Commit

Permalink
Fix unix dgram socket address resolution on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
mranney authored and ry committed Jul 15, 2010
1 parent 02729d4 commit 98341da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/node_net.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ static Handle<Value> Connect(const Arguments& args) {
return Undefined();
}

#if defined(__APPLE__)
#define SUN_LEN(ptr) (ptr->sun_len-2)
#endif

#define ADDRESS_TO_JS(info, address_storage) \
do { \
Expand All @@ -374,10 +377,14 @@ do { \
case AF_UNIX: \
au = (struct sockaddr_un*)&(address_storage); \
char un_path[105]; \
strncpy(un_path, au->sun_path, au->sun_len-2); \
un_path[au->sun_len-2] = 0; \
size_t len; \
len = SUN_LEN(au); \
strncpy(un_path, au->sun_path, len); \
un_path[len] = 0; \
(info)->Set(address_symbol, String::New(un_path)); \
break; \
default: \
(info)->Set(address_symbol, String::New("")); \
} \
} while (0)

Expand Down

0 comments on commit 98341da

Please sign in to comment.