summary refs log tree commit diff stats
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2011-09-25 06:25:35 +0200
committerRiku Voipio <riku.voipio@linaro.org>2011-10-27 14:42:16 +0300
commitf4c690101c74afcc58deead71f6302fe343718b7 (patch)
tree575f1629822f182b5dd62c1c7e3263c428c53776 /linux-user/syscall.c
parentcbb21eed186647716b9e8404a9e90d3fc5c6c467 (diff)
downloadfocaccia-qemu-f4c690101c74afcc58deead71f6302fe343718b7.tar.gz
focaccia-qemu-f4c690101c74afcc58deead71f6302fe343718b7.zip
linux-user: fix openat
When running openat using qemu-arm, we stumbled over invalid permissions
on the created files. The reason for this is that the mode parameter gets
treates as an O_... flag, which it isn't - it's a permission bitmask.

This patch removes the needless translation of the mode parameter,
rendering permission passing of openat() to work with linux-user.

Reported-by: Dirk Mueller <dmueller@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9a633571a7..615957120c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -379,25 +379,13 @@ static int sys_mknodat(int dirfd, const char *pathname, mode_t mode,
 }
 #endif
 #ifdef TARGET_NR_openat
-static int sys_openat(int dirfd, const char *pathname, int flags, ...)
+static int sys_openat(int dirfd, const char *pathname, int flags, mode_t mode)
 {
   /*
    * open(2) has extra parameter 'mode' when called with
    * flag O_CREAT.
    */
   if ((flags & O_CREAT) != 0) {
-      va_list ap;
-      mode_t mode;
-
-      /*
-       * Get the 'mode' parameter and translate it to
-       * host bits.
-       */
-      va_start(ap, flags);
-      mode = va_arg(ap, mode_t);
-      mode = target_to_host_bitmask(mode, fcntl_flags_tbl);
-      va_end(ap);
-
       return (openat(dirfd, pathname, flags, mode));
   }
   return (openat(dirfd, pathname, flags));