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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux