From 793a482015ec670186ac53b2c753f299ed27307c Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 23 Jul 2012 17:40:55 +0100 Subject: launch: libvirt: Use accept4 to set socket flags correctly. --- src/launch-libvirt.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/launch-libvirt.c') diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c index 268efa5a..bedd5ea1 100644 --- a/src/launch-libvirt.c +++ b/src/launch-libvirt.c @@ -271,7 +271,7 @@ launch_libvirt (guestfs_h *g, const char *libvirt_uri) g->state = LAUNCHING; /* Wait for console socket to open. */ - r = accept (console, NULL, NULL); + r = accept4 (console, NULL, NULL, SOCK_NONBLOCK|SOCK_CLOEXEC); if (r == -1) { perrorf (g, "accept"); goto cleanup; @@ -283,10 +283,6 @@ launch_libvirt (guestfs_h *g, const char *libvirt_uri) } g->fd[0] = r; /* This is the accepted console socket. */ - if (fcntl (g->fd[0], F_SETFL, O_NONBLOCK|O_CLOEXEC) == -1) { - perrorf (g, "fcntl"); - goto cleanup; - } g->fd[1] = dup (g->fd[0]); if (g->fd[1] == -1) { perrorf (g, "dup"); -- cgit