qemuDomainCreateDeviceRecursive: Report error if mkdir() fails

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@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
This commit is contained in:
Michal Privoznik 2019-10-04 20:59:10 +02:00
parent 096e94cef6
commit 6bc746d66d

View File

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