aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2016-06-22 20:53:20 +0800
committerKevin Wolf <kwolf@redhat.com>2016-07-13 13:26:02 +0200
commit5af7045bd0d45cff5c8eb0a3b14b900d9bd24998 (patch)
treef61f61927a4aa7552fcf5f5a3fb82ad1badb8ea7
parent761d1ddf25988eeb110a612b0a42945fa1b561a5 (diff)
raw-posix: Use qemu_dup
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/raw-posix.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c
index c979ac3fd1..d1c3bd8e47 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -639,15 +639,7 @@ static int raw_reopen_prepare(BDRVReopenState *state,
if ((raw_s->open_flags & ~fcntl_flags) == (s->open_flags & ~fcntl_flags)) {
/* dup the original fd */
- /* TODO: use qemu fcntl wrapper */
-#ifdef F_DUPFD_CLOEXEC
- raw_s->fd = fcntl(s->fd, F_DUPFD_CLOEXEC, 0);
-#else
- raw_s->fd = dup(s->fd);
- if (raw_s->fd != -1) {
- qemu_set_cloexec(raw_s->fd);
- }
-#endif
+ raw_s->fd = qemu_dup(s->fd);
if (raw_s->fd >= 0) {
ret = fcntl_setfl(raw_s->fd, raw_s->open_flags);
if (ret) {