mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Pre-create the toplevel libvirt config directory
This commit is contained in:
parent
31ea5e9733
commit
6ad5b9d5fb
@ -1,3 +1,8 @@
|
|||||||
|
Wed Feb 14 17:01:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* qemud/qemud.c: Ensure we create the main libvirt config
|
||||||
|
directory at startup
|
||||||
|
|
||||||
Wed Feb 14 16:47:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
Wed Feb 14 16:47:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* qemud/conf.c: Fixed generation of <features> block, and
|
* qemud/conf.c: Fixed generation of <features> block, and
|
||||||
|
@ -239,6 +239,7 @@ static int qemudListen(struct qemud_server *server, int sys) {
|
|||||||
|
|
||||||
static struct qemud_server *qemudInitialize(int sys) {
|
static struct qemud_server *qemudInitialize(int sys) {
|
||||||
struct qemud_server *server;
|
struct qemud_server *server;
|
||||||
|
char libvirtConf[PATH_MAX];
|
||||||
|
|
||||||
if (!(server = calloc(1, sizeof(struct qemud_server))))
|
if (!(server = calloc(1, sizeof(struct qemud_server))))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -249,6 +250,15 @@ static struct qemud_server *qemudInitialize(int sys) {
|
|||||||
server->nextvmid = 1;
|
server->nextvmid = 1;
|
||||||
|
|
||||||
if (sys) {
|
if (sys) {
|
||||||
|
if (snprintf(libvirtConf, sizeof(libvirtConf), "%s/libvirt", SYSCONF_DIR) >= (int)sizeof(libvirtConf)) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
if (mkdir(libvirtConf, 0777) < 0) {
|
||||||
|
if (errno != EEXIST) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (snprintf(server->configDir, sizeof(server->configDir), "%s/libvirt/qemu", SYSCONF_DIR) >= (int)sizeof(server->configDir)) {
|
if (snprintf(server->configDir, sizeof(server->configDir), "%s/libvirt/qemu", SYSCONF_DIR) >= (int)sizeof(server->configDir)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -258,6 +268,7 @@ static struct qemud_server *qemudInitialize(int sys) {
|
|||||||
} else {
|
} else {
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
int uid;
|
int uid;
|
||||||
|
|
||||||
if ((uid = geteuid()) < 0) {
|
if ((uid = geteuid()) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -265,6 +276,16 @@ static struct qemud_server *qemudInitialize(int sys) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (snprintf(libvirtConf, sizeof(libvirtConf), "%s/.libvirt", pw->pw_dir) >= (int)sizeof(libvirtConf)) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
if (mkdir(libvirtConf, 0777) < 0) {
|
||||||
|
if (errno != EEXIST) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (snprintf(server->configDir, sizeof(server->configDir), "%s/.libvirt/qemu", pw->pw_dir) >= (int)sizeof(server->configDir)) {
|
if (snprintf(server->configDir, sizeof(server->configDir), "%s/.libvirt/qemu", pw->pw_dir) >= (int)sizeof(server->configDir)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user