From 3fa6bcfca4bb50b18935cc4637426ef3ac3cdcbd Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Mon, 25 Oct 2010 10:31:15 +0200 Subject: [PATCH] Fix binding to a unix socket on OSX addr.sun_path doesn't like the first byte to be NULL Signed-off-by: Ruben Kerkhof --- daemon/libvirtd.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 8e88d05..76b8dc8 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -571,13 +571,14 @@ static int qemudListenUnix(struct qemud_server *server, virSetNonBlock(sock->fd) < 0) goto cleanup; + if (path[0] == '@') + path[0] = '\0'; + sock->addr.data.un.sun_family = AF_UNIX; if (virStrcpyStatic(sock->addr.data.un.sun_path, path) == NULL) { VIR_ERROR(_("Path %s too long for unix socket"), path); goto cleanup; } - if (sock->addr.data.un.sun_path[0] == '@') - sock->addr.data.un.sun_path[0] = '\0'; oldgrp = getgid(); oldmask = umask(readonly ? ~unix_sock_ro_mask : ~unix_sock_rw_mask); -- 1.7.3.1