[libvirt] [PATCH] win32: Pretend that close-on-exec works
Eric Blake
eblake at redhat.com
Tue Oct 9 21:09:16 UTC 2012
On 10/09/2012 02:56 PM, Matthias Bolte wrote:
> Currently virNetSocketNew fails because virSetCloseExec fails as there
> is no proper implementation for it on Windows at the moment. Workaround
> this by pretending that setting close-on-exec on the fd works. This can
> be done because libvirt currently lacks the ability to create child
> processes on Windows anyway. So there is no point in failing to set a
> flag that isn't useful at the moment anyway.
> ---
> src/util/util.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/src/util/util.c b/src/util/util.c
> index 43fdaf1..356a03a 100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -275,7 +275,11 @@ int virSetInherit(int fd, bool inherit) {
>
> int virSetInherit(int fd ATTRIBUTE_UNUSED, bool inherit ATTRIBUTE_UNUSED)
> {
> - return -1;
> + /* FIXME: Currently creating child processes is not supported on
> + * Win32, so there is no point in failing calls that are only relevant
> + * when creating child processes. So just pretend that we changed the
> + * inheritance property of the given fd as requested. */
> + return 0;
Actually, gnulib CAN do this on Windows, but we aren't using the gnulib
cloexec module. However, getting that in place is a bit more involved,
so your patch is fine as an interim measure.
ACK.
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121009/6c4d7d6c/attachment-0001.sig>
More information about the libvir-list
mailing list