ext/zeromq/src/ipc_address.cpp in rbczmq-1.7.1 vs ext/zeromq/src/ipc_address.cpp in rbczmq-1.7.2
- old
+ new
@@ -1,8 +1,7 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
- Copyright (c) 2011 Other contributors as noted in the AUTHORS file
+ Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
@@ -53,10 +52,14 @@
return -1;
}
address.sun_family = AF_UNIX;
strcpy (address.sun_path, path_);
+#if defined ZMQ_HAVE_LINUX
+ if (*path_ == '@')
+ *address.sun_path = '\0';
+#endif
return 0;
}
int zmq::ipc_address_t::to_string (std::string &addr_)
{
@@ -64,10 +67,18 @@
addr_.clear ();
return -1;
}
std::stringstream s;
+#if !defined ZMQ_HAVE_LINUX
s << "ipc://" << address.sun_path;
+#else
+ s << "ipc://";
+ if (*address.sun_path)
+ s << address.sun_path;
+ else
+ s << "@" << address.sun_path + 1;
+#endif
addr_ = s.str ();
return 0;
}
const sockaddr *zmq::ipc_address_t::addr () const