summaryrefslogtreecommitdiff
path: root/sys/compat/linux32
diff options
context:
space:
mode:
authornjoly <njoly@NetBSD.org>2014-05-18 09:30:00 +0000
committernjoly <njoly@NetBSD.org>2014-05-18 09:30:00 +0000
commitc14fb7b15abfadeecf8ead602b5ca7fb44ec4bcc (patch)
tree898c07544031d1412b034fc407562c67b19b3c4a /sys/compat/linux32
parent7879567381d7b056297c42d4aea7f8febb7cbe29 (diff)
Simplify dup3 emulation to call dodup() directly instead of
sys_dup2()+fd_set_exclose(). While here, add some error conditions.
Diffstat (limited to 'sys/compat/linux32')
-rw-r--r--sys/compat/linux32/common/linux32_unistd.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/sys/compat/linux32/common/linux32_unistd.c b/sys/compat/linux32/common/linux32_unistd.c
index 90aa1c23cf1..7855b067c84 100644
--- a/sys/compat/linux32/common/linux32_unistd.c
+++ b/sys/compat/linux32/common/linux32_unistd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_unistd.c,v 1.37 2014/05/04 10:08:53 njoly Exp $ */
+/* $NetBSD: linux32_unistd.c,v 1.38 2014/05/18 09:30:00 njoly Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.37 2014/05/04 10:08:53 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.38 2014/05/18 09:30:00 njoly Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -293,19 +293,13 @@ linux32_sys_dup3(struct lwp *l, const struct linux32_sys_dup3_args *uap,
syscallarg(int) to;
syscallarg(int) flags;
} */
- struct sys_dup2_args ua;
- int error;
+ struct linux_sys_dup3_args ua;
NETBSD32TO64_UAP(from);
NETBSD32TO64_UAP(to);
+ NETBSD32TO64_UAP(flags);
- if ((error = sys_dup2(l, &ua, retval)))
- return error;
-
- if (SCARG(uap, flags) & LINUX_O_CLOEXEC)
- fd_set_exclose(l, SCARG(uap, to), true);
-
- return 0;
+ return linux_sys_dup3(l, &ua, retval);
}