diff mbox

tools/libxendevicemodel: define O_CLOEXEC

Message ID 20170301122708.20560-1-olaf@aepfle.de (mailing list archive)
State New, archived
Headers show

Commit Message

Olaf Hering March 1, 2017, 12:27 p.m. UTC
Similar defines are already used elsewhere.
Fixes e7745d8ef5 ("tools/libxendevicemodel: introduce a Linux-specific
implementation")

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 tools/libs/devicemodel/linux.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Wei Liu March 1, 2017, 12:37 p.m. UTC | #1
On Wed, Mar 01, 2017 at 12:27:08PM +0000, Olaf Hering wrote:
> Similar defines are already used elsewhere.

I think I would like to change this a bit to be more explicit:

Some libc headers don't have O_CLOEXEC, we need to take care of it by
defining to 0 (on the ground that such glibc might barf on O_CLOEXEC).

If you don't object, I will use the above paragraph.

> Fixes e7745d8ef5 ("tools/libxendevicemodel: introduce a Linux-specific
> implementation")
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  tools/libs/devicemodel/linux.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/libs/devicemodel/linux.c b/tools/libs/devicemodel/linux.c
> index 438c55bf2c..0fdc7121f1 100644
> --- a/tools/libs/devicemodel/linux.c
> +++ b/tools/libs/devicemodel/linux.c
> @@ -31,6 +31,10 @@
>  
>  #include "private.h"
>  
> +#ifndef O_CLOEXEC
> +#define O_CLOEXEC 0
> +#endif
> +
>  int osdep_xendevicemodel_open(xendevicemodel_handle *dmod)
>  {
>      int fd = open("/dev/xen/privcmd", O_RDWR | O_CLOEXEC);
diff mbox

Patch

diff --git a/tools/libs/devicemodel/linux.c b/tools/libs/devicemodel/linux.c
index 438c55bf2c..0fdc7121f1 100644
--- a/tools/libs/devicemodel/linux.c
+++ b/tools/libs/devicemodel/linux.c
@@ -31,6 +31,10 @@ 
 
 #include "private.h"
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 int osdep_xendevicemodel_open(xendevicemodel_handle *dmod)
 {
     int fd = open("/dev/xen/privcmd", O_RDWR | O_CLOEXEC);