提交 01cd90b6 编写于 作者: S Stefano Stabellini

xen: call qemu_set_cloexec instead of fcntl

Use the common utility function, which contains checks on return values
and first calls F_GETFD as recommended by POSIX.1-2001, instead of
manually calling fcntl.

CID: 1374831
Signed-off-by: NStefano Stabellini <sstabellini@kernel.org>
Reviewed-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NGreg Kurz <groug@kaod.org>
CC: anthony.perard@citrix.com
CC: groug@kaod.org
CC: aneesh.kumar@linux.vnet.ibm.com
CC: Eric Blake <eblake@redhat.com>
上级 c0c24b95
...@@ -380,7 +380,7 @@ static int xen_9pfs_connect(struct XenDevice *xendev) ...@@ -380,7 +380,7 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
if (xen_9pdev->rings[i].evtchndev == NULL) { if (xen_9pdev->rings[i].evtchndev == NULL) {
goto out; goto out;
} }
fcntl(xenevtchn_fd(xen_9pdev->rings[i].evtchndev), F_SETFD, FD_CLOEXEC); qemu_set_cloexec(xenevtchn_fd(xen_9pdev->rings[i].evtchndev));
xen_9pdev->rings[i].local_port = xenevtchn_bind_interdomain xen_9pdev->rings[i].local_port = xenevtchn_bind_interdomain
(xen_9pdev->rings[i].evtchndev, (xen_9pdev->rings[i].evtchndev,
xendev->dom, xendev->dom,
......
...@@ -147,7 +147,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev, ...@@ -147,7 +147,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
qdev_unplug(DEVICE(xendev), NULL); qdev_unplug(DEVICE(xendev), NULL);
return NULL; return NULL;
} }
fcntl(xenevtchn_fd(xendev->evtchndev), F_SETFD, FD_CLOEXEC); qemu_set_cloexec(xenevtchn_fd(xendev->evtchndev));
if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) { if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
xendev->gnttabdev = xengnttab_open(NULL, 0); xendev->gnttabdev = xengnttab_open(NULL, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册