aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 39553c81b6..41ded90ee6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8490,11 +8490,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#endif
#if defined(CONFIG_DUP3) && defined(TARGET_NR_dup3)
case TARGET_NR_dup3:
- ret = get_errno(dup3(arg1, arg2, arg3));
+ {
+ int host_flags;
+
+ if ((arg3 & ~TARGET_O_CLOEXEC) != 0) {
+ return -EINVAL;
+ }
+ host_flags = target_to_host_bitmask(arg3, fcntl_flags_tbl);
+ ret = get_errno(dup3(arg1, arg2, host_flags));
if (ret >= 0) {
fd_trans_dup(arg1, arg2);
}
break;
+ }
#endif
#ifdef TARGET_NR_getppid /* not on alpha */
case TARGET_NR_getppid: