[PATCH 1/6] qemuDomainCreateDeviceRecursive: Report error if mkdir() fails

Michal Privoznik mprivozn at redhat.com
Wed Mar 18 17:32:11 UTC 2020


The virFileMakePathWithMode() which is our recursive version of
mkdir() fails, it simply just returns a negative value with errno
set. No error is reported (as compared to virFileTouch() for
instance).

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_domain.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0e2252f6cf..48bf5ae559 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -14643,8 +14643,12 @@ qemuDomainCreateDeviceRecursive(const char *device,
          * proper owner and mode. Bind mount only after that. */
     } else if (isDir) {
         if (create &&
-            virFileMakePathWithMode(devicePath, sb.st_mode) < 0)
+            virFileMakePathWithMode(devicePath, sb.st_mode) < 0) {
+            virReportSystemError(errno,
+                                 _("Unable to make dir %s"),
+                                 devicePath);
             goto cleanup;
+        }
     } else {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("unsupported device type %s 0%o"),
-- 
2.24.1




More information about the libvir-list mailing list