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

Pavel Mores pmores at redhat.com
Thu Mar 19 15:02:31 UTC 2020


On Wed, Mar 18, 2020 at 06:32:11PM +0100, Michal Privoznik wrote:
> 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
> 

Reviewed-by: Pavel Mores <pmores at redhat.com>




More information about the libvir-list mailing list