summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2007-10-03 23:30:11 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2007-10-03 23:30:11 +0000
commit52d1cf20b73013064578a03d4126f47b44a8635c (patch)
tree858f8a8eaf4813b571bd345405805791ab4504e5
parent8834e6253d34be2d66dc5e149bdbb11b82bae25e (diff)
downloadmemcached-52d1cf20b73013064578a03d4126f47b44a8635c.tar.gz
Fix for Unix Domain sockets on FreeBSD
FreeBSD's sendmsg() requires msg_name in msghdr structure to be NULL if not used, setting msg_namelen to 0 isn't enough. Patch from Maxim Dounin <mdounin@mdounin.ru> git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@624 b0b603af-a30f-0410-a34e-baf09ae79d0b
-rw-r--r--ChangeLog5
-rw-r--r--memcached.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b10157..860ee7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,11 @@
* The memcached-tool script can now display stats. Patch
provided by Dan Christian <dchristian@google.com>
+ * Fix for Unix Domain sockets on FreeBSD
+ FreeBSD's sendmsg() requires msg_name in msghdr structure
+ to be NULL if not used, setting msg_namelen to 0 isn't enough.
+ Patch from Maxim Dounin <mdounin@mdounin.ru>
+
2007-08-21 Paul Lindner <lindner@inuus.com>
* Incorporate incrememnt patch from Evan Miller
<emiller@imvu.com> to define increment overflow
diff --git a/memcached.c b/memcached.c
index 42969aa..d8e717d 100644
--- a/memcached.c
+++ b/memcached.c
@@ -218,8 +218,11 @@ static int add_msghdr(conn *c)
memset(msg, 0, sizeof(struct msghdr));
msg->msg_iov = &c->iov[c->iovused];
- msg->msg_name = &c->request_addr;
- msg->msg_namelen = c->request_addr_size;
+
+ if (c->request_addr_size > 0) {
+ msg->msg_name = &c->request_addr;
+ msg->msg_namelen = c->request_addr_size;
+ }
c->msgbytes = 0;
c->msgused++;