+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>
* qemud/conf.c: Fixed generation of <features> block, and
static struct qemud_server *qemudInitialize(int sys) {
struct qemud_server *server;
+ char libvirtConf[PATH_MAX];
if (!(server = calloc(1, sizeof(struct qemud_server))))
return NULL;
server->nextvmid = 1;
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)) {
goto cleanup;
}
} else {
struct passwd *pw;
int uid;
+
if ((uid = geteuid()) < 0) {
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)) {
goto cleanup;
}