Skip to content

Commit

Permalink
linux-user: fix openat
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Riku Voipio <[email protected]>
  • Loading branch information
agraf authored and Riku Voipio committed Oct 27, 2011
1 parent cbb21ee commit f4c6901
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions linux-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit f4c6901

Please sign in to comment.