提交 f4c69010 编写于 作者: A Alexander Graf 提交者: Riku Voipio

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: NDirk Mueller <dmueller@suse.de>
Signed-off-by: NAlexander Graf <agraf@suse.de>
Signed-off-by: NRiku Voipio <riku.voipio@iki.fi>
上级 cbb21eed
...@@ -379,25 +379,13 @@ static int sys_mknodat(int dirfd, const char *pathname, mode_t mode, ...@@ -379,25 +379,13 @@ static int sys_mknodat(int dirfd, const char *pathname, mode_t mode,
} }
#endif #endif
#ifdef TARGET_NR_openat #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 * open(2) has extra parameter 'mode' when called with
* flag O_CREAT. * flag O_CREAT.
*/ */
if ((flags & O_CREAT) != 0) { 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, mode));
} }
return (openat(dirfd, pathname, flags)); return (openat(dirfd, pathname, flags));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册