From 384c5cff377d529005cf13f6f6e1bb74a687f758 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Fri, 25 Apr 2008 15:46:46 +0000 Subject: [PATCH] group ownership of /var/run/libvirt/ * qemud/qemud.c: applied patch from Anton Protopopov to change group ownership of /var/run/libvirt/ to unix_sock_gid. Daniel --- ChangeLog | 5 +++++ qemud/qemud.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index abe6dc42a0..dc02c43038 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Apr 25 17:44:28 CEST 2008 Daniel Veillard + + * qemud/qemud.c: applied patch from Anton Protopopov to change + group ownership of /var/run/libvirt/ to unix_sock_gid. + Fri Apr 25 16:51:58 CEST 2008 Jim Meyering avoid problems with sign-extended "char" operand to is* functions diff --git a/qemud/qemud.c b/qemud/qemud.c index 23af04242d..a7b27ee544 100644 --- a/qemud/qemud.c +++ b/qemud/qemud.c @@ -2156,6 +2156,18 @@ int main(int argc, char **argv) { if (remoteReadConfigFile (server, remote_config_file) < 0) goto error1; + /* Change the group ownership of /var/run/libvirt to unix_sock_gid */ + if (getuid() != 0) { + qemudLog (QEMUD_WARN, + "%s", _("Cannot set group ownership when not running as root")); + } else { + const char *sockdirname = LOCAL_STATE_DIR "/run/libvirt"; + + if (chown(sockdirname, -1, unix_sock_gid) < 0) + qemudLog(QEMUD_ERR, "%s %s", + _("Failed to change group ownership of "), sockdirname); + } + if (godaemon) { openlog("libvirtd", 0, 0); if (qemudGoDaemon() < 0) { -- GitLab