diff --git a/src/serialport_unix.cpp b/src/serialport_unix.cpp index 87ce773..cedfd03 100644 --- a/src/serialport_unix.cpp +++ b/src/serialport_unix.cpp @@ -131,6 +131,9 @@ void EIO_Open(uv_work_t* req) { OpenBaton* data = static_cast(req->data); int flags = (O_RDWR | O_NOCTTY | O_NONBLOCK | O_CLOEXEC | O_SYNC); + if(data->hupcl == false) { + flags &= ~HUPCL; + } int fd = open(data->path, flags); if(-1 == setup(fd, data)){ @@ -172,20 +175,6 @@ int setup(int fd, OpenBaton *data) { return -1; } - - // int flags = (O_RDWR | O_NOCTTY | O_NONBLOCK | O_CLOEXEC | O_SYNC); - // if(data->hupcl == false) { - // flags &= ~HUPCL; - // } - // int fd = open(data->path, flags); - - int flags = (O_RDWR | O_NOCTTY | O_NONBLOCK | O_CLOEXEC | O_SYNC); - if(data->hupcl == false) { - flags &= ~HUPCL; - } - fd = open(data->path, flags); - - if (fd == -1) { snprintf(data->errorString, sizeof(data->errorString), "Cannot open %s", data->path); return -1;