diff mbox series

[10/51] hw/usb: dev-mtp: Use g_mkdir_with_parents()

Message ID 20220824094029.1634519-11-bmeng.cn@gmail.com (mailing list archive)
State New, archived
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Commit Message

Bin Meng Aug. 24, 2022, 9:39 a.m. UTC
From: Bin Meng <bin.meng@windriver.com>

Use the same g_mkdir_with_parents() call to create a directory on
all platforms.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 hw/usb/dev-mtp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc-André Lureau Aug. 31, 2022, 1:09 p.m. UTC | #1
On Wed, Aug 24, 2022 at 1:48 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> From: Bin Meng <bin.meng@windriver.com>
>
> Use the same g_mkdir_with_parents() call to create a directory on
> all platforms.
>
>
Same comment as earlier regarding g_mkdir() vs _with_parent().


> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
>  hw/usb/dev-mtp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
> index 5831395cef..97c894f231 100644
> --- a/hw/usb/dev-mtp.c
> +++ b/hw/usb/dev-mtp.c
> @@ -1622,7 +1622,7 @@ static void usb_mtp_write_data(MTPState *s, uint32_t
> handle)
>          if (s->dataset.filename) {
>              path = g_strdup_printf("%s/%s", parent->path,
> s->dataset.filename);
>              if (s->dataset.format == FMT_ASSOCIATION) {
> -                ret = mkdir(path, mask);
> +                ret = g_mkdir_with_parents(path, mask);
>                  if (!ret) {
>                      usb_mtp_queue_result(s, RES_OK, d->trans, 3,
>                                           QEMU_STORAGE_ID,
> --
> 2.34.1
>
>
>
diff mbox series

Patch

diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 5831395cef..97c894f231 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -1622,7 +1622,7 @@  static void usb_mtp_write_data(MTPState *s, uint32_t handle)
         if (s->dataset.filename) {
             path = g_strdup_printf("%s/%s", parent->path, s->dataset.filename);
             if (s->dataset.format == FMT_ASSOCIATION) {
-                ret = mkdir(path, mask);
+                ret = g_mkdir_with_parents(path, mask);
                 if (!ret) {
                     usb_mtp_queue_result(s, RES_OK, d->trans, 3,
                                          QEMU_STORAGE_ID,