summary refs log tree commit diff stats
path: root/hw/usb/dev-mtp.c
diff options
context:
space:
mode:
authorVolker RĂ¼melin <vr_qemu@t-online.de>2022-01-22 15:06:19 +0100
committerGerd Hoffmann <kraxel@redhat.com>2022-03-04 09:34:21 +0100
commit7c204e96384b8e03b917fd30abf3bc96da237990 (patch)
tree39d0125f8b4f49635f77c2996c59e4400c94d3bc /hw/usb/dev-mtp.c
parent42c93917f7829190fcae05c5c0827d0c187d7713 (diff)
downloadfocaccia-qemu-7c204e96384b8e03b917fd30abf3bc96da237990.tar.gz
focaccia-qemu-7c204e96384b8e03b917fd30abf3bc96da237990.zip
hw/usb/dev-mtp: create directories with a+x mode mask
Current code creates directories with mode 0644. Even the creator
can't create files in the new directory. Set all x mode flags in
variable mask and clear all x mode flags in function open() to
preserve the current open mode.

Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de>
Message-Id: <20220122140619.7514-1-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/dev-mtp.c')
-rw-r--r--hw/usb/dev-mtp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 1e6ac76bef..e6b77a2a94 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -1607,7 +1607,7 @@ static void usb_mtp_write_data(MTPState *s, uint32_t handle)
         usb_mtp_object_lookup(s, s->dataset.parent_handle);
     char *path = NULL;
     uint64_t rc;
-    mode_t mask = 0644;
+    mode_t mask = 0755;
     int ret = 0;
 
     assert(d != NULL);
@@ -1635,7 +1635,7 @@ static void usb_mtp_write_data(MTPState *s, uint32_t handle)
             }
 
             d->fd = open(path, O_CREAT | O_WRONLY |
-                         O_CLOEXEC | O_NOFOLLOW, mask);
+                         O_CLOEXEC | O_NOFOLLOW, mask & 0666);
             if (d->fd == -1) {
                 ret = 1;
                 goto done;