diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-07-23 17:40:55 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-07-23 18:08:16 +0100 |
commit | 793a482015ec670186ac53b2c753f299ed27307c (patch) | |
tree | caac2998684800a91a1b214b934232ebc6f55a7e /src/launch-libvirt.c | |
parent | 5fb0f4e07ecaa3e084d3ae173606d6f03df393c3 (diff) | |
download | libguestfs-793a482015ec670186ac53b2c753f299ed27307c.tar.gz libguestfs-793a482015ec670186ac53b2c753f299ed27307c.tar.xz libguestfs-793a482015ec670186ac53b2c753f299ed27307c.zip |
launch: libvirt: Use accept4 to set socket flags correctly.
Diffstat (limited to 'src/launch-libvirt.c')
-rw-r--r-- | src/launch-libvirt.c | 6 |
1 files changed, 1 insertions, 5 deletions
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"); |