mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-25 18:37:19 +00:00
Fixes double open() call on unix
This commit is contained in:
parent
5df5a779ee
commit
7151eb3fbf
1 changed files with 3 additions and 14 deletions
|
|
@ -131,6 +131,9 @@ void EIO_Open(uv_work_t* req) {
|
|||
OpenBaton* data = static_cast<OpenBaton*>(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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue