Skip to content

Commit d55aba8

Browse files
committed
modbus-rtu: don't use O_EXCL when opening the device
Quote from 'man 2 open': -snip- ... In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. ... -snap- Since we don't create the device file here - we just want to open (hopefully) existing ones - let's simply drop this flag to be on the safe side. Signed-off-by: Michael Heimpold <[email protected]>
1 parent bb13443 commit d55aba8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/modbus-rtu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ static int _modbus_rtu_connect(modbus_t *ctx)
639639
640640
Timeouts are ignored in canonical input mode or when the
641641
NONBLOCK option is set on the file via open or fcntl */
642-
flags = O_RDWR | O_NOCTTY | O_NONBLOCK | O_EXCL;
642+
flags = O_RDWR | O_NOCTTY | O_NONBLOCK;
643643
#ifdef O_CLOEXEC
644644
flags |= O_CLOEXEC;
645645
#endif

0 commit comments

Comments
 (0)