[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH] launch: add missing headers on Darwin



On Wednesday 04 November 2015 12:05:31 Margaret Lewicka wrote:
> Including sys/un.h for sockaddr_un and sys/fcntl.h for
> O_CLOEXEC/O_NONBLOCK.
> ---
>  src/launch-libvirt.c | 1 +
>  src/launch-unix.c    | 4 ++++
>  2 files changed, 5 insertions(+)
>
> diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
> index 1649884..ad07210 100644
> --- a/src/launch-libvirt.c
> +++ b/src/launch-libvirt.c
> @@ -52,6 +52,7 @@
>  /* Fixes for Mac OS X */
>  #if defined __APPLE__ && defined __MACH__
>  #include <sys/un.h>
> +#include <sys/fcntl.h>
>  #endif
>  #ifndef SOCK_CLOEXEC
>  # define SOCK_CLOEXEC O_CLOEXEC
> diff --git a/src/launch-unix.c b/src/launch-unix.c
> index 5cce9c1..f57910d 100644
> --- a/src/launch-unix.c
> +++ b/src/launch-unix.c
> @@ -25,6 +25,10 @@
>  #include <string.h>
>  #include <libintl.h>
>
> +#if defined __APPLE__ && defined __MACH__
> +#include <sys/un.h>
> +#endif
> +
>  #include "guestfs.h"
>  #include "guestfs-internal.h"
>  #include "guestfs_protocol.h"

NACK, these OS-specific blocks are hard to maintain, and it makes no
sense to enclose POSIX headers in them.

Can you please try the attached patch? I see Rich already pushed your
patch, but IMHO that should be reverted and this one should go...

--
Pino Toscano
From 1104481a94b868f79da189c0971e96f5c693cb26 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano redhat com>
Date: Wed, 4 Nov 2015 13:26:21 +0100
Subject: [PATCH] lib: include few more headers

- include <sys/un.h> for sockaddr_un, on any OS (removing the Mac OS X
  blocks)
- include <fcntl.h> for O_* flags

This commits reverts a couple of changes in these files done in
commit 3b17152ec399acb35b23331d2c3b4f424a68824a.
---
 src/launch-libvirt.c | 5 ++---
 src/launch-unix.c    | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index 1649884..2faf813 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -23,12 +23,14 @@
 #include <stdarg.h>
 #include <stdbool.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <grp.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <assert.h>
 #include <string.h>
 #include <libintl.h>
+#include <sys/un.h>

 #ifdef HAVE_LIBVIRT
 #include <libvirt/libvirt.h>
@@ -50,9 +52,6 @@
 #include "guestfs_protocol.h"

 /* Fixes for Mac OS X */
-#if defined __APPLE__ && defined __MACH__
-#include <sys/un.h>
-#endif
 #ifndef SOCK_CLOEXEC
 # define SOCK_CLOEXEC O_CLOEXEC
 #endif
diff --git a/src/launch-unix.c b/src/launch-unix.c
index 5cce9c1..6d6ad75 100644
--- a/src/launch-unix.c
+++ b/src/launch-unix.c
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/socket.h>
+#include <sys/un.h>
 #include <string.h>
 #include <libintl.h>

--
2.1.0

Attachment: signature.asc
Description: This is a digitally signed message part.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]