From nobody Mon Feb 9 02:51:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614591426; cv=none; d=zohomail.com; s=zohoarc; b=foqnWuoYNoqPg02JW5NhkzI2xLRbQPC0OkUBxH3O8q6tURgaPOXCx8OG1bWv4edTTlv5s0xREmvOHLbtJNj65CLjZYZRloQZClWvq3qg3G01Mz54JoHd4n1w3ysP29Dk2elhXC/n4RlmHjwhT5S2D0BR24zTWLWpxsRvqcb00YM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614591426; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=n9XI0ANWjXye2V1QCBt6oPF/n4Fux8D98jhwd/LlZy0=; b=Bmd4WyAYkpqrx/FA7Nv3mUF/leSIwHp6UaykcMfZk0j8GUzJMdRSCu+zhqmrwJOLAw2uxgh6tqks8fI5TpqXu+AczT2E7YoLKZYuYSE5Np1QZJRCwTziMIePIyHKFPXR/BGF9dP4Ss1r+mPbzGtB++gxC7WeDGyolLcZs5zRiiA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614591426080800.0798493415681; Mon, 1 Mar 2021 01:37:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-iymQyrGqM9GjIC-egTD8vQ-1; Mon, 01 Mar 2021 04:37:02 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A811319357A4; Mon, 1 Mar 2021 09:36:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 840EC59472; Mon, 1 Mar 2021 09:36:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 49AF157DFE; Mon, 1 Mar 2021 09:36:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1219aObf013742 for ; Mon, 1 Mar 2021 04:36:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2FC9660C04; Mon, 1 Mar 2021 09:36:24 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AB2A60BFA for ; Mon, 1 Mar 2021 09:36:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614591424; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=n9XI0ANWjXye2V1QCBt6oPF/n4Fux8D98jhwd/LlZy0=; b=VPH1C/NViluDrS/XcmpgOt0jX0rjeJp9jGzBn8S6Myb86TtUjCNTa9kALnlin+Wbofc9Yu ms+R4oSIndRUe6FGF9GsLFV6q6UQGGf274WE9JEK7Kc4NvjzP9xesLil7P5EoQQ3kdHJ6Q +2GLz3vXM+le3n+w50uyhYspgXxN9yY= X-MC-Unique: iymQyrGqM9GjIC-egTD8vQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] lib: Replace virFileMakePath() with g_mkdir_with_parents() Date: Mon, 1 Mar 2021 10:36:15 +0100 Message-Id: <22a3fde0fdc2c08b004a63c280a6436c90ed062f.1614589944.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Generated using the following spatch: @@ expression path; @@ - virFileMakePath(path) + g_mkdir_with_parents(path, 0777) However, 14 occurrences were not replaced, e.g. in virHostdevManagerNew(). I don't really understand why. Fixed by hand afterwards. Signed-off-by: Michal Privoznik --- src/bhyve/bhyve_driver.c | 6 +++--- src/conf/domain_conf.c | 2 +- src/conf/network_conf.c | 2 +- src/conf/virnetworkportdef.c | 2 +- src/conf/virnwfilterbindingobj.c | 2 +- src/conf/virstorageobj.c | 2 +- src/hypervisor/virhostdev.c | 4 ++-- src/libxl/libxl_conf.c | 2 +- src/libxl/libxl_driver.c | 12 ++++++------ src/locking/lock_daemon.c | 4 ++-- src/logging/log_daemon.c | 4 ++-- src/lxc/lxc_container.c | 18 +++++++++--------- src/lxc/lxc_controller.c | 4 ++-- src/lxc/lxc_driver.c | 4 ++-- src/lxc/lxc_fuse.c | 2 +- src/lxc/lxc_process.c | 2 +- src/network/bridge_driver.c | 12 ++++++------ src/qemu/qemu_checkpoint.c | 2 +- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_driver.c | 26 +++++++++++++------------- src/qemu/qemu_namespace.c | 4 ++-- src/qemu/qemu_process.c | 2 +- src/remote/remote_daemon.c | 2 +- src/storage/storage_driver.c | 4 ++-- src/storage/storage_util.c | 2 +- src/util/vircgroupv1.c | 4 ++-- src/util/vircgroupv2.c | 2 +- src/util/virdaemon.c | 2 +- src/util/virdnsmasq.c | 2 +- src/util/virfile.c | 4 ++-- src/util/virfilecache.c | 2 +- src/util/virlog.c | 2 +- src/util/virpidfile.c | 2 +- src/util/virresctrl.c | 2 +- tests/securityselinuxlabeltest.c | 4 ++-- tests/vboxsnapshotxmltest.c | 2 +- tests/vircgroupmock.c | 2 +- tests/virhostdevtest.c | 2 +- tests/virpcimock.c | 12 ++++++------ tests/virstoragetest.c | 4 ++-- 40 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index d02dc65a9d..8363259d4c 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -385,7 +385,7 @@ bhyveDomainSetAutostart(virDomainPtr domain, int autost= art) goto cleanup; =20 if (autostart) { - if (virFileMakePath(BHYVE_AUTOSTART_DIR) < 0) { + if (g_mkdir_with_parents(BHYVE_AUTOSTART_DIR, 0777) < 0) { virReportSystemError(errno, _("cannot create autostart directory = %s"), BHYVE_AUTOSTART_DIR); @@ -1265,14 +1265,14 @@ bhyveStateInitialize(bool privileged, if (virBhyveLoadDriverConfig(bhyve_driver->config, SYSCONFDIR "/libvir= t/bhyve.conf") < 0) goto cleanup; =20 - if (virFileMakePath(BHYVE_LOG_DIR) < 0) { + if (g_mkdir_with_parents(BHYVE_LOG_DIR, 0777) < 0) { virReportSystemError(errno, _("Failed to mkdir %s"), BHYVE_LOG_DIR); goto cleanup; } =20 - if (virFileMakePath(BHYVE_STATE_DIR) < 0) { + if (g_mkdir_with_parents(BHYVE_STATE_DIR, 0777) < 0) { virReportSystemError(errno, _("Failed to mkdir %s"), BHYVE_STATE_DIR); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b731744f04..a918bfe189 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29351,7 +29351,7 @@ virDomainDefSaveXML(virDomainDefPtr def, if ((configFile =3D virDomainConfigFile(configDir, def->name)) =3D=3D = NULL) return -1; =20 - if (virFileMakePath(configDir) < 0) { + if (g_mkdir_with_parents(configDir, 0777) < 0) { virReportSystemError(errno, _("cannot create config directory '%s'"), configDir); diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index f32710b781..1b24a900bd 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2762,7 +2762,7 @@ virNetworkSaveXML(const char *configDir, if ((configFile =3D virNetworkConfigFile(configDir, def->name)) =3D=3D= NULL) return -1; =20 - if (virFileMakePath(configDir) < 0) { + if (g_mkdir_with_parents(configDir, 0777) < 0) { virReportSystemError(errno, _("cannot create config directory '%s'"), configDir); diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c index 21ebbdb054..3923d2aa37 100644 --- a/src/conf/virnetworkportdef.c +++ b/src/conf/virnetworkportdef.c @@ -443,7 +443,7 @@ virNetworkPortDefSaveStatus(virNetworkPortDef *def, =20 virUUIDFormat(def->uuid, uuidstr); =20 - if (virFileMakePath(dir) < 0) + if (g_mkdir_with_parents(dir, 0777) < 0) return -1; =20 if (!(path =3D virNetworkPortDefConfigFile(dir, uuidstr))) diff --git a/src/conf/virnwfilterbindingobj.c b/src/conf/virnwfilterbinding= obj.c index 584721f8b6..2f29670f9f 100644 --- a/src/conf/virnwfilterbindingobj.c +++ b/src/conf/virnwfilterbindingobj.c @@ -160,7 +160,7 @@ virNWFilterBindingObjSave(const virNWFilterBindingObj *= obj, if (!(xml =3D virNWFilterBindingObjFormat(obj))) goto cleanup; =20 - if (virFileMakePath(statusDir) < 0) { + if (g_mkdir_with_parents(statusDir, 0777) < 0) { virReportSystemError(errno, _("cannot create config directory '%s'"), statusDir); diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 6a8874b1fb..69c2c2da36 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -1777,7 +1777,7 @@ virStoragePoolObjSaveDef(virStorageDriverStatePtr dri= ver, virStoragePoolDefPtr def) { if (!obj->configFile) { - if (virFileMakePath(driver->configDir) < 0) { + if (g_mkdir_with_parents(driver->configDir, 0777) < 0) { virReportSystemError(errno, _("cannot create config directory %s"), driver->configDir); diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index 743aaa84d6..316327f004 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -171,7 +171,7 @@ virHostdevManagerNew(void) if (privileged) { hostdevMgr->stateDir =3D g_strdup(HOSTDEV_STATE_DIR); =20 - if (virFileMakePath(hostdevMgr->stateDir) < 0) { + if (g_mkdir_with_parents(hostdevMgr->stateDir, 0777) < 0) { virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to create state dir '%s'"), hostdevMgr->stateDir); @@ -187,7 +187,7 @@ virHostdevManagerNew(void) =20 old_umask =3D umask(077); =20 - if (virFileMakePath(hostdevMgr->stateDir) < 0) { + if (g_mkdir_with_parents(hostdevMgr->stateDir, 0777) < 0) { umask(old_umask); virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to create state dir '%s'"), diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index f8db118996..0eceab383c 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1789,7 +1789,7 @@ libxlDriverConfigInit(libxlDriverConfigPtr cfg) { unsigned int free_mem; =20 - if (virFileMakePath(cfg->logDir) < 0) { + if (g_mkdir_with_parents(cfg->logDir, 0777) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create log dir '%s': %s"), cfg->logDir, diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 75a8d46af0..fcfcf7c11c 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -721,35 +721,35 @@ libxlStateInitialize(bool privileged, libxl_event_register_callbacks(cfg->ctx, &ev_hooks, libxl_driver); =20 libxl_driver->config =3D cfg; - if (virFileMakePath(cfg->stateDir) < 0) { + if (g_mkdir_with_parents(cfg->stateDir, 0777) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create state dir '%s': %s"), cfg->stateDir, g_strerror(errno)); goto error; } - if (virFileMakePath(cfg->libDir) < 0) { + if (g_mkdir_with_parents(cfg->libDir, 0777) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create lib dir '%s': %s"), cfg->libDir, g_strerror(errno)); goto error; } - if (virFileMakePath(cfg->saveDir) < 0) { + if (g_mkdir_with_parents(cfg->saveDir, 0777) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create save dir '%s': %s"), cfg->saveDir, g_strerror(errno)); goto error; } - if (virFileMakePath(cfg->autoDumpDir) < 0) { + if (g_mkdir_with_parents(cfg->autoDumpDir, 0777) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create dump dir '%s': %s"), cfg->autoDumpDir, g_strerror(errno)); goto error; } - if (virFileMakePath(cfg->channelDir) < 0) { + if (g_mkdir_with_parents(cfg->channelDir, 0777) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create channel dir '%s': %s"), cfg->channelDir, @@ -4543,7 +4543,7 @@ libxlDomainSetAutostart(virDomainPtr dom, int autosta= rt) goto endjob; =20 if (autostart) { - if (virFileMakePath(cfg->autostartDir) < 0) { + if (g_mkdir_with_parents(cfg->autostartDir, 0777) < 0) { virReportSystemError(errno, _("cannot create autostart directory = %s"), cfg->autostartDir); diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index d68c61b099..04038d2668 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -602,7 +602,7 @@ virLockDaemonExecRestartStatePath(bool privileged, rundir =3D virGetUserRuntimeDirectory(); =20 old_umask =3D umask(077); - if (virFileMakePath(rundir) < 0) { + if (g_mkdir_with_parents(rundir, 0777) < 0) { umask(old_umask); return -1; } @@ -993,7 +993,7 @@ int main(int argc, char **argv) { else old_umask =3D umask(077); VIR_DEBUG("Ensuring run dir '%s' exists", run_dir); - if (virFileMakePath(run_dir) < 0) { + if (g_mkdir_with_parents(run_dir, 0777) < 0) { VIR_ERROR(_("unable to create rundir %s: %s"), run_dir, g_strerror(errno)); ret =3D VIR_DAEMON_ERR_RUNDIR; diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index cc0b96ea05..aa76dcd329 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -407,7 +407,7 @@ virLogDaemonExecRestartStatePath(bool privileged, rundir =3D virGetUserRuntimeDirectory(); =20 old_umask =3D umask(077); - if (virFileMakePath(rundir) < 0) { + if (g_mkdir_with_parents(rundir, 0777) < 0) { umask(old_umask); return -1; } @@ -780,7 +780,7 @@ int main(int argc, char **argv) { else old_umask =3D umask(077); VIR_DEBUG("Ensuring run dir '%s' exists", run_dir); - if (virFileMakePath(run_dir) < 0) { + if (g_mkdir_with_parents(run_dir, 0777) < 0) { VIR_ERROR(_("unable to create rundir %s: %s"), run_dir, g_strerror(errno)); ret =3D VIR_DAEMON_ERR_RUNDIR; diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 2a5f8711c4..70b776e172 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -665,7 +665,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root) =20 oldroot =3D g_strdup_printf("%s/.oldroot", root->src->path); =20 - if (virFileMakePath(oldroot) < 0) { + if (g_mkdir_with_parents(oldroot, 0777) < 0) { virReportSystemError(errno, _("Failed to create %s"), oldroot); @@ -684,7 +684,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root) /* Create a directory called 'new' in tmpfs */ newroot =3D g_strdup_printf("%s/new", oldroot); =20 - if (virFileMakePath(newroot) < 0) { + if (g_mkdir_with_parents(newroot, 0777) < 0) { virReportSystemError(errno, _("Failed to create %s"), newroot); @@ -889,7 +889,7 @@ static int lxcContainerMountBasicFS(bool userns_enabled, continue; } =20 - if (virFileMakePath(mnt->dst) < 0) { + if (g_mkdir_with_parents(mnt->dst, 0777) < 0) { virReportSystemError(errno, _("Failed to mkdir %s"), mnt->dst); @@ -969,7 +969,7 @@ static int lxcContainerMountFSDev(virDomainDefPtr def, =20 path =3D g_strdup_printf("/.oldroot/%s/%s.dev", stateDir, def->name); =20 - if (virFileMakePath("/dev") < 0) { + if (g_mkdir_with_parents("/dev", 0777) < 0) { virReportSystemError(errno, "%s", _("Cannot create /dev")); return -1; @@ -998,7 +998,7 @@ static int lxcContainerMountFSDevPTS(virDomainDefPtr de= f, =20 path =3D g_strdup_printf("/.oldroot/%s/%s.devpts", stateDir, def->name= ); =20 - if (virFileMakePath("/dev/pts") < 0) { + if (g_mkdir_with_parents("/dev/pts", 0777) < 0) { virReportSystemError(errno, "%s", _("Cannot create /dev/pts")); return -1; @@ -1080,7 +1080,7 @@ static int lxcContainerMountFSBind(virDomainFSDefPtr = fs, return -1; } if (S_ISDIR(st.st_mode)) { - if (virFileMakePath(fs->dst) < 0) { + if (g_mkdir_with_parents(fs->dst, 0777) < 0) { virReportSystemError(errno, _("Failed to create %s"), fs->dst); @@ -1349,7 +1349,7 @@ static int lxcContainerMountFSBlockHelper(virDomainFS= DefPtr fs, if (fs->readonly) fsflags |=3D MS_RDONLY; =20 - if (virFileMakePath(fs->dst) < 0) { + if (g_mkdir_with_parents(fs->dst, 0777) < 0) { virReportSystemError(errno, _("Failed to create %s"), fs->dst); @@ -1403,7 +1403,7 @@ static int lxcContainerMountFSTmpfs(virDomainFSDefPtr= fs, =20 data =3D g_strdup_printf("size=3D%lld%s", fs->usage, sec_mount_options= ); =20 - if (virFileMakePath(fs->dst) < 0) { + if (g_mkdir_with_parents(fs->dst, 0777) < 0) { virReportSystemError(errno, _("Failed to create %s"), fs->dst); @@ -1508,7 +1508,7 @@ int lxcContainerSetupHostdevCapsMakePath(const char *= dev) =20 if ((tmp =3D strrchr(dir, '/'))) { *tmp =3D '\0'; - if (virFileMakePath(dir) < 0) { + if (g_mkdir_with_parents(dir, 0777) < 0) { virReportSystemError(errno, _("Failed to create directory for '%s' de= v '%s'"), dir, dev); diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 8f166a436a..f633a24b16 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1608,7 +1608,7 @@ virLXCControllerSetupHostdevSubsysUSB(virDomainDefPtr= vmDef, =20 mode =3D 0700 | S_IFCHR; =20 - if (virFileMakePath(dstdir) < 0) { + if (g_mkdir_with_parents(dstdir, 0777) < 0) { virReportSystemError(errno, _("Unable to create %s"), dstdir); return -1; @@ -2128,7 +2128,7 @@ virLXCControllerSetupDevPTS(virLXCControllerPtr ctrl) devpts =3D g_strdup_printf("%s/%s.devpts", LXC_STATE_DIR, ctrl->def->n= ame); ctrl->devptmx =3D g_strdup_printf("%s/%s.devpts/ptmx", LXC_STATE_DIR, = ctrl->def->name); =20 - if (virFileMakePath(devpts) < 0) { + if (g_mkdir_with_parents(devpts, 0777) < 0) { virReportSystemError(errno, _("Failed to make path %s"), devpts); diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 4416acf923..9a12e25fab 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1535,7 +1535,7 @@ static int lxcStateInitialize(bool privileged, if (!(lxc_driver->closeCallbacks =3D virCloseCallbacksNew())) goto cleanup; =20 - if (virFileMakePath(cfg->stateDir) < 0) { + if (g_mkdir_with_parents(cfg->stateDir, 0777) < 0) { virReportSystemError(errno, _("Failed to mkdir %s"), cfg->stateDir); @@ -2515,7 +2515,7 @@ static int lxcDomainSetAutostart(virDomainPtr dom, goto endjob; =20 if (autostart) { - if (virFileMakePath(cfg->autostartDir) < 0) { + if (g_mkdir_with_parents(cfg->autostartDir, 0777) < 0) { virReportSystemError(errno, _("Cannot create autostart directory %s"), cfg->autostartDir); diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 6e23361617..10ddd59a99 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -291,7 +291,7 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def) =20 fuse->mountpoint =3D g_strdup_printf("%s/%s.fuse/", LXC_STATE_DIR, def= ->name); =20 - if (virFileMakePath(fuse->mountpoint) < 0) { + if (g_mkdir_with_parents(fuse->mountpoint, 0777) < 0) { virReportSystemError(errno, _("Cannot create %s"), fuse->mountpoint); goto cleanup1; diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index cbc04a3dcd..18577344b0 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -1257,7 +1257,7 @@ int virLXCProcessStart(virConnectPtr conn, } } =20 - if (virFileMakePath(cfg->logDir) < 0) { + if (g_mkdir_with_parents(cfg->logDir, 0777) < 0) { virReportSystemError(errno, _("Cannot create log directory '%s'"), cfg->logDir); diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 519a473995..1ec6953ed4 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -737,7 +737,7 @@ networkStateInitialize(bool privileged, network_driver->radvdStateDir =3D g_strdup_printf("%s/radvd/lib", = rundir); } =20 - if (virFileMakePath(network_driver->stateDir) < 0) { + if (g_mkdir_with_parents(network_driver->stateDir, 0777) < 0) { virReportSystemError(errno, _("cannot create directory %s"), network_driver->stateDir); @@ -1618,7 +1618,7 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr drive= r, if (!needDnsmasq && def->dns.enable =3D=3D VIR_TRISTATE_BOOL_NO) return 0; =20 - if (virFileMakePath(driver->pidDir) < 0) { + if (g_mkdir_with_parents(driver->pidDir, 0777) < 0) { virReportSystemError(errno, _("cannot create directory %s"), driver->pidDir); @@ -1628,7 +1628,7 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr drive= r, if (!(pidfile =3D virPidFileBuildPath(driver->pidDir, def->name))) return -1; =20 - if (virFileMakePath(driver->dnsmasqStateDir) < 0) { + if (g_mkdir_with_parents(driver->dnsmasqStateDir, 0777) < 0) { virReportSystemError(errno, _("cannot create directory %s"), driver->dnsmasqStateDir); @@ -1901,14 +1901,14 @@ networkStartRadvd(virNetworkDriverStatePtr driver, return -1; } =20 - if (virFileMakePath(driver->pidDir) < 0) { + if (g_mkdir_with_parents(driver->pidDir, 0777) < 0) { virReportSystemError(errno, _("cannot create directory %s"), driver->pidDir); return -1; } =20 - if (virFileMakePath(driver->radvdStateDir) < 0) { + if (g_mkdir_with_parents(driver->radvdStateDir, 0777) < 0) { virReportSystemError(errno, _("cannot create directory %s"), driver->radvdStateDir); @@ -4003,7 +4003,7 @@ networkSetAutostart(virNetworkPtr net, goto cleanup; =20 if (new_autostart) { - if (virFileMakePath(driver->networkAutostartDir) < 0) { + if (g_mkdir_with_parents(driver->networkAutostartDir, 0777) < = 0) { virReportSystemError(errno, _("cannot create autostart directory = '%s'"), driver->networkAutostartDir); diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 1740cadabf..689a556959 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -123,7 +123,7 @@ qemuCheckpointWriteMetadata(virDomainObjPtr vm, return -1; =20 chkDir =3D g_strdup_printf("%s/%s", checkpointDir, vm->def->name); - if (virFileMakePath(chkDir) < 0) { + if (g_mkdir_with_parents(chkDir, 0777) < 0) { virReportSystemError(errno, _("cannot create checkpoint directory = '%s'"), chkDir); return -1; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bb14fe2e33..17fa71c21b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6786,7 +6786,7 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm, return -1; =20 snapDir =3D g_strdup_printf("%s/%s", snapshotDir, vm->def->name); - if (virFileMakePath(snapDir) < 0) { + if (g_mkdir_with_parents(snapDir, 0777) < 0) { virReportSystemError(errno, _("cannot create snapshot directory '%= s'"), snapDir); return -1; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b9bbdf8d48..598c2b432a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -654,57 +654,57 @@ qemuStateInitialize(bool privileged, if (virQEMUDriverConfigSetDefaults(cfg) < 0) goto error; =20 - if (virFileMakePath(cfg->stateDir) < 0) { + if (g_mkdir_with_parents(cfg->stateDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create state dir %s"), cfg->stateDir); goto error; } - if (virFileMakePath(cfg->libDir) < 0) { + if (g_mkdir_with_parents(cfg->libDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create lib dir %s"), cfg->libDir); goto error; } - if (virFileMakePath(cfg->cacheDir) < 0) { + if (g_mkdir_with_parents(cfg->cacheDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create cache dir %s"), cfg->cacheDir); goto error; } - if (virFileMakePath(cfg->saveDir) < 0) { + if (g_mkdir_with_parents(cfg->saveDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create save dir %s"), cfg->saveDir); goto error; } - if (virFileMakePath(cfg->snapshotDir) < 0) { + if (g_mkdir_with_parents(cfg->snapshotDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create snapshot dir %s"), cfg->snapshotDir); goto error; } - if (virFileMakePath(cfg->checkpointDir) < 0) { + if (g_mkdir_with_parents(cfg->checkpointDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create checkpoint dir %s"= ), cfg->checkpointDir); goto error; } - if (virFileMakePath(cfg->autoDumpPath) < 0) { + if (g_mkdir_with_parents(cfg->autoDumpPath, 0777) < 0) { virReportSystemError(errno, _("Failed to create dump dir %s"), cfg->autoDumpPath); goto error; } - if (virFileMakePath(cfg->channelTargetDir) < 0) { + if (g_mkdir_with_parents(cfg->channelTargetDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create channel target dir= %s"), cfg->channelTargetDir); goto error; } - if (virFileMakePath(cfg->nvramDir) < 0) { + if (g_mkdir_with_parents(cfg->nvramDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create nvram dir %s"), cfg->nvramDir); goto error; } - if (virFileMakePath(cfg->memoryBackingDir) < 0) { + if (g_mkdir_with_parents(cfg->memoryBackingDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create memory backing dir= %s"), cfg->memoryBackingDir); goto error; } - if (virFileMakePath(cfg->slirpStateDir) < 0) { + if (g_mkdir_with_parents(cfg->slirpStateDir, 0777) < 0) { virReportSystemError(errno, _("Failed to create slirp state dir %s= "), cfg->slirpStateDir); goto error; @@ -891,7 +891,7 @@ qemuStateInitialize(bool privileged, if (!hugepagePath) goto error; =20 - if (virFileMakePath(hugepagePath) < 0) { + if (g_mkdir_with_parents(hugepagePath, 0777) < 0) { virReportSystemError(errno, _("unable to create hugepage path %s"), hugepagePath); @@ -8266,7 +8266,7 @@ static int qemuDomainSetAutostart(virDomainPtr dom, goto endjob; =20 if (autostart) { - if (virFileMakePath(cfg->autostartDir) < 0) { + if (g_mkdir_with_parents(cfg->autostartDir, 0777) < 0) { virReportSystemError(errno, _("cannot create autostart directory = %s"), cfg->autostartDir); diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index f4b4d4d9ec..cc08aa8c36 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -720,7 +720,7 @@ qemuDomainUnshareNamespace(virQEMUDriverConfigPtr cfg, /* At this point, devMountsPath is either: * a file (regular or special), or * a directory. */ - if ((S_ISDIR(sb.st_mode) && virFileMakePath(devMountsSavePath[i]) = < 0) || + if ((S_ISDIR(sb.st_mode) && g_mkdir_with_parents(devMountsSavePath= [i], 0777) < 0) || (!S_ISDIR(sb.st_mode) && virFileTouch(devMountsSavePath[i], sb= .st_mode) < 0)) { virReportSystemError(errno, _("Failed to create %s"), @@ -749,7 +749,7 @@ qemuDomainUnshareNamespace(virQEMUDriverConfigPtr cfg, } =20 if (S_ISDIR(sb.st_mode)) { - if (virFileMakePath(devMountsPath[i]) < 0) { + if (g_mkdir_with_parents(devMountsPath[i], 0777) < 0) { virReportSystemError(errno, _("Cannot create %s"), devMountsPath[i]); goto cleanup; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 944664ca28..d3208e5203 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6713,7 +6713,7 @@ qemuProcessPrepareHost(virQEMUDriverPtr driver, VIR_DEBUG("Ensuring no historical cgroup is lying around"); qemuRemoveCgroup(vm); =20 - if (virFileMakePath(cfg->logDir) < 0) { + if (g_mkdir_with_parents(cfg->logDir, 0777) < 0) { virReportSystemError(errno, _("cannot create log directory %s"), cfg->logDir); diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 635e1deec8..c5563a0e80 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -999,7 +999,7 @@ int main(int argc, char **argv) { else old_umask =3D umask(077); VIR_DEBUG("Ensuring run dir '%s' exists", run_dir); - if (virFileMakePath(run_dir) < 0) { + if (g_mkdir_with_parents(run_dir, 0777) < 0) { VIR_ERROR(_("unable to create rundir %s: %s"), run_dir, g_strerror(errno)); ret =3D VIR_DAEMON_ERR_RUNDIR; diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 9c5be071df..ecb5b86b4f 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -291,7 +291,7 @@ storageStateInitialize(bool privileged, } driver->privileged =3D privileged; =20 - if (virFileMakePath(driver->stateDir) < 0) { + if (g_mkdir_with_parents(driver->stateDir, 0777) < 0) { virReportError(errno, _("cannot create directory %s"), driver->stateDir); @@ -1398,7 +1398,7 @@ storagePoolSetAutostart(virStoragePoolPtr pool, cur_autostart =3D virStoragePoolObjIsAutostart(obj); if (cur_autostart !=3D new_autostart) { if (new_autostart) { - if (virFileMakePath(driver->autostartDir) < 0) { + if (g_mkdir_with_parents(driver->autostartDir, 0777) < 0) { virReportSystemError(errno, _("cannot create autostart directory = %s"), driver->autostartDir); diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index b5adb05826..75c4c8eccd 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -2811,7 +2811,7 @@ virStorageBackendBuildLocal(virStoragePoolObjPtr pool) /* assure all directories in the path prior to the final dir * exist, with default uid/gid/mode. */ *p =3D '\0'; - if (virFileMakePath(parent) < 0) { + if (g_mkdir_with_parents(parent, 0777) < 0) { virReportSystemError(errno, _("cannot create path '%s'"), parent); return -1; diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 79015ddaa4..bc79aaa775 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -864,7 +864,7 @@ virCgroupV1BindMount(virCgroupPtr group, =20 VIR_DEBUG("Mounting cgroups at '%s'", root); =20 - if (virFileMakePath(root) < 0) { + if (g_mkdir_with_parents(root, 0777) < 0) { virReportSystemError(errno, _("Unable to create directory %s"), root); @@ -890,7 +890,7 @@ virCgroupV1BindMount(virCgroupPtr group, =20 VIR_DEBUG("Create mount point '%s'", group->legacy[i].mountPoint); - if (virFileMakePath(group->legacy[i].mountPoint) < 0) { + if (g_mkdir_with_parents(group->legacy[i].mountPoint, 0777) < = 0) { virReportSystemError(errno, _("Unable to create directory %s"), group->legacy[i].mountPoint); diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 24c7e64c67..3c1f1d97dd 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -595,7 +595,7 @@ virCgroupV2BindMount(virCgroupPtr group, =20 VIR_DEBUG("Mounting cgroups at '%s'", group->unified.mountPoint); =20 - if (virFileMakePath(group->unified.mountPoint) < 0) { + if (g_mkdir_with_parents(group->unified.mountPoint, 0777) < 0) { virReportSystemError(errno, _("Unable to create directory %s"), group->unified.mountPoint); return -1; diff --git a/src/util/virdaemon.c b/src/util/virdaemon.c index a02665dce8..bb2df2eb2c 100644 --- a/src/util/virdaemon.c +++ b/src/util/virdaemon.c @@ -238,7 +238,7 @@ virDaemonUnixSocketPaths(const char *sock_prefix, rundir =3D virGetUserRuntimeDirectory(); =20 old_umask =3D umask(077); - if (virFileMakePath(rundir) < 0) { + if (g_mkdir_with_parents(rundir, 0777) < 0) { umask(old_umask); goto cleanup; } diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c index 3eee4a5a84..3913114eca 100644 --- a/src/util/virdnsmasq.c +++ b/src/util/virdnsmasq.c @@ -524,7 +524,7 @@ dnsmasqSave(const dnsmasqContext *ctx) { int ret =3D 0; =20 - if (virFileMakePath(ctx->config_dir) < 0) { + if (g_mkdir_with_parents(ctx->config_dir, 0777) < 0) { virReportSystemError(errno, _("cannot create config directory '%s'= "), ctx->config_dir); return -1; diff --git a/src/util/virfile.c b/src/util/virfile.c index bba0e892ea..23e334872f 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3698,7 +3698,7 @@ virFileSetupDev(const char *path, const unsigned long mount_flags =3D MS_NOSUID; const char *mount_fs =3D "tmpfs"; =20 - if (virFileMakePath(path) < 0) { + if (g_mkdir_with_parents(path, 0777) < 0) { virReportSystemError(errno, _("Failed to make path %s"), path); return -1; @@ -3723,7 +3723,7 @@ virFileBindMountDevice(const char *src, { if (!virFileExists(dst)) { if (virFileIsDir(src)) { - if (virFileMakePath(dst) < 0) { + if (g_mkdir_with_parents(dst, 0777) < 0) { virReportSystemError(errno, _("Unable to make dir %s"), ds= t); return -1; } diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c index 14b2885505..f2324b2cf2 100644 --- a/src/util/virfilecache.c +++ b/src/util/virfilecache.c @@ -106,7 +106,7 @@ virFileCacheGetFileName(virFileCachePtr cache, if (virCryptoHashString(VIR_CRYPTO_HASH_SHA256, name, &namehash) < 0) return NULL; =20 - if (virFileMakePath(cache->dir) < 0) { + if (g_mkdir_with_parents(cache->dir, 0777) < 0) { virReportSystemError(errno, _("Unable to create directory '%s'"), cache->dir); diff --git a/src/util/virlog.c b/src/util/virlog.c index cdfeba8251..d1e9aa5432 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -176,7 +176,7 @@ virLogSetDefaultOutputToFile(const char *binary, bool p= rivileged) logdir =3D virGetUserCacheDirectory(); =20 old_umask =3D umask(077); - if (virFileMakePath(logdir) < 0) { + if (g_mkdir_with_parents(logdir, 0777) < 0) { umask(old_umask); return -1; } diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 4c38ebe500..c6389c1869 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -93,7 +93,7 @@ int virPidFileWrite(const char *dir, if (name =3D=3D NULL || dir =3D=3D NULL) return -EINVAL; =20 - if (virFileMakePath(dir) < 0) + if (g_mkdir_with_parents(dir, 0777) < 0) return -errno; =20 if (!(pidfile =3D virPidFileBuildPath(dir, name))) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index ab35bccfc5..0460be8d3a 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2337,7 +2337,7 @@ virResctrlCreateGroupPath(const char *path) if (virFileExists(path)) return 0; =20 - if (virFileMakePath(path) < 0) { + if (g_mkdir_with_parents(path, 0777) < 0) { virReportSystemError(errno, _("Cannot create resctrl directory '%s'"), path); diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabelt= est.c index 168acc2bdf..b1bf6e0f95 100644 --- a/tests/securityselinuxlabeltest.c +++ b/tests/securityselinuxlabeltest.c @@ -62,7 +62,7 @@ testUserXattrEnabled(void) char *path =3D NULL; path =3D g_strdup_printf("%s/securityselinuxlabeldata/testxattr", abs_= builddir); =20 - if (virFileMakePath(abs_builddir "/securityselinuxlabeldata") < 0 || + if (g_mkdir_with_parents(abs_builddir "/securityselinuxlabeldata", 077= 7) < 0 || virFileTouch(path, 0600) < 0) goto cleanup; =20 @@ -221,7 +221,7 @@ testSELinuxCreateDisks(testSELinuxFile *files, size_t n= files) { size_t i; =20 - if (virFileMakePath(abs_builddir "/securityselinuxlabeldata/nfs") < 0) + if (g_mkdir_with_parents(abs_builddir "/securityselinuxlabeldata/nfs",= 0777) < 0) return -1; =20 for (i =3D 0; i < nfiles; i++) { diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c index 9298bcb837..e44ca7fc98 100644 --- a/tests/vboxsnapshotxmltest.c +++ b/tests/vboxsnapshotxmltest.c @@ -54,7 +54,7 @@ testCompareXMLtoXMLFiles(const char *xml) =20 pathResult =3D g_strdup(abs_builddir "/vboxsnapshotxmldata/testResult.= vbox"); =20 - if (virFileMakePath(abs_builddir "/vboxsnapshotxmldata") < 0) + if (g_mkdir_with_parents(abs_builddir "/vboxsnapshotxmldata", 0777) < = 0) goto cleanup; =20 if (virTestLoadFile(xml, &xmlData) < 0) diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c index dac6b6b991..5d7badc44a 100644 --- a/tests/vircgroupmock.c +++ b/tests/vircgroupmock.c @@ -371,7 +371,7 @@ static void init_sysfs(void) fakesysfscgroupdir =3D g_strdup_printf("%s%s", fakerootdir, SYSFS_CGROUP_PREFIX); =20 - if (virFileMakePath(fakesysfscgroupdir) < 0) { + if (g_mkdir_with_parents(fakesysfscgroupdir, 0777) < 0) { fprintf(stderr, "Cannot create %s\n", fakesysfscgroupdir); abort(); } diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 91f9112e8b..d3c0bca1c0 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -162,7 +162,7 @@ myInit(void) if ((mgr->activeNVMeHostdevs =3D virNVMeDeviceListNew()) =3D=3D NULL) goto cleanup; mgr->stateDir =3D g_strdup(TEST_STATE_DIR); - if (virFileMakePath(mgr->stateDir) < 0) + if (g_mkdir_with_parents(mgr->stateDir, 0777) < 0) goto cleanup; =20 return 0; diff --git a/tests/virpcimock.c b/tests/virpcimock.c index d1c6220c57..be513ad918 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -201,7 +201,7 @@ make_dir(const char *path, =20 dirpath =3D g_strdup_printf("%s/%s", path, name); =20 - if (virFileMakePath(dirpath) < 0) + if (g_mkdir_with_parents(dirpath, 0777) < 0) ABORT("Unable to create: %s", dirpath); } =20 @@ -405,7 +405,7 @@ pci_device_create_iommu(const struct pciDevice *dev, iommuPath =3D g_strdup_printf("%s/sys/kernel/iommu_groups/%d/devices/", fakerootdir, dev->iommuGroup); =20 - if (virFileMakePath(iommuPath) < 0) + if (g_mkdir_with_parents(iommuPath, 0777) < 0) ABORT("Unable to create: %s", iommuPath); =20 if (g_snprintf(tmp, sizeof(tmp), @@ -473,7 +473,7 @@ pci_device_new_from_stub(const struct pciDevice *data) if (!(devpath =3D pci_device_get_path(dev, NULL, true))) ABORT_OOM(); =20 - if (virFileMakePath(devpath) < 0) + if (g_mkdir_with_parents(devpath, 0777) < 0) ABORT("Unable to create: %s", devpath); =20 if (stat(configSrc, &sb) =3D=3D 0) @@ -693,7 +693,7 @@ pci_driver_new(const char *name, ...) if (!(driverpath =3D pci_driver_get_path(driver, NULL, true))) ABORT_OOM(); =20 - if (virFileMakePath(driverpath) < 0) + if (g_mkdir_with_parents(driverpath, 0777) < 0) ABORT("Unable to create: %s", driverpath); =20 va_start(args, name); @@ -954,7 +954,7 @@ init_env(void) =20 tmp =3D g_strdup_printf("%s%s", fakerootdir, SYSFS_PCI_PREFIX); =20 - if (virFileMakePath(tmp) < 0) + if (g_mkdir_with_parents(tmp, 0777) < 0) ABORT("Unable to create: %s", tmp); =20 make_dir(tmp, "devices"); @@ -965,7 +965,7 @@ init_env(void) VIR_FREE(tmp); tmp =3D g_strdup_printf("%s/dev/vfio", fakerootdir); =20 - if (virFileMakePath(tmp) < 0) + if (g_mkdir_with_parents(tmp, 0777) < 0) ABORT("Unable to create: %s", tmp); =20 make_file(tmp, "vfio", NULL, -1); diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 762328df9a..84dd813b80 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -141,11 +141,11 @@ testPrepImages(void) absdir =3D g_strdup_printf("%s/dir", datadir); abslink2 =3D g_strdup_printf("%s/sub/link2", datadir); =20 - if (virFileMakePath(datadir "/sub") < 0) { + if (g_mkdir_with_parents(datadir "/sub", 0777) < 0) { fprintf(stderr, "unable to create directory %s\n", datadir "/sub"); goto cleanup; } - if (virFileMakePath(datadir "/dir") < 0) { + if (g_mkdir_with_parents(datadir "/dir", 0777) < 0) { fprintf(stderr, "unable to create directory %s\n", datadir "/dir"); goto cleanup; } --=20 2.26.2