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>
This commit is contained in:
parent
761d1ddf25
commit
5af7045bd0
|
@ -639,15 +639,7 @@ static int raw_reopen_prepare(BDRVReopenState *state,
|
||||||
|
|
||||||
if ((raw_s->open_flags & ~fcntl_flags) == (s->open_flags & ~fcntl_flags)) {
|
if ((raw_s->open_flags & ~fcntl_flags) == (s->open_flags & ~fcntl_flags)) {
|
||||||
/* dup the original fd */
|
/* dup the original fd */
|
||||||
/* TODO: use qemu fcntl wrapper */
|
raw_s->fd = qemu_dup(s->fd);
|
||||||
#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
|
|
||||||
if (raw_s->fd >= 0) {
|
if (raw_s->fd >= 0) {
|
||||||
ret = fcntl_setfl(raw_s->fd, raw_s->open_flags);
|
ret = fcntl_setfl(raw_s->fd, raw_s->open_flags);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
Loading…
Reference in a new issue