]> sigrok.org Git - libserialport.git/blobdiff - serialport.c
Use O_CLOEXEC where available
[libserialport.git] / serialport.c
index 2c1b68217eaf0747d93761fc5af61a6accaa45c4..9e56e89aed61c1347bef3b08f867ff2344f7772e 100644 (file)
@@ -563,7 +563,7 @@ SP_API enum sp_return sp_open(struct sp_port *port, enum sp_mode flags)
                RETURN_CODEVAL(ret);
        }
 #else
-       int flags_local = O_NONBLOCK | O_NOCTTY;
+       int flags_local = O_NONBLOCK | O_NOCTTY | O_CLOEXEC;
 
        /* Map 'flags' to the OS-specific settings. */
        if ((flags & SP_MODE_READ_WRITE) == SP_MODE_READ_WRITE)