]> sigrok.org Git - libserialport.git/blobdiff - libserialport_internal.h
Use O_CLOEXEC where available
[libserialport.git] / libserialport_internal.h
index dd69733e9f38a0b3b76764d61890fd7dec3c513f..d784472bb12d0c218413d645ff38e3dec8588da3 100644 (file)
 #define TIOCOUTQ FIONWRITE
 #endif
 
+/*
+ * O_CLOEXEC is not available everywhere, fallback to not setting the
+ * flag on those systems.
+ */
+#ifndef _WIN32
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+#endif
+
 /* Non-standard baudrates are not available everywhere. */
 #if (defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED)) && HAVE_DECL_BOTHER
 #define USE_TERMIOS_SPEED