qcap: Fix compile error when O_CLOEXEC is not defined.

Sebastian Lackner sebastian at fds-team.de
Tue Mar 7 09:12:18 CST 2017


Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---

Defining to 0 ensures that it doesn't do any harm. If we don't
care about ancient systems, we can probably also remove the fcntl call.
On modern systems, setting CLOEXEC twice (via open and fcntl) shouldn't
hurt.

 dlls/qcap/v4l.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index d67df73b0cd..bbe3a8b1da5 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -71,6 +71,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap_v4l);
 
 #ifdef VIDIOCMCAPTURE
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 static typeof(open) *video_open = open;
 static typeof(close) *video_close = close;
 static typeof(ioctl) *video_ioctl = ioctl;
@@ -806,6 +810,7 @@ Capture * qcap_driver_init( IPin *pOut, USHORT card )
         goto error;
     }
 
+    fcntl(capBox->fd, F_SETFD, FD_CLOEXEC);
     memset(&capa, 0, sizeof(capa));
 
     if (xioctl(capBox->fd, VIDIOCGCAP, &capa) == -1)
-- 
2.11.0



More information about the wine-patches mailing list