Commit 21975be
root
SerialImp.c:RXTXCommDriver(testRead) - fcntl(,F_SETFL, O_RDWR) does not work on Linux
NeuronRobotics#257
On linux F_SETFL cannot change O_RDONLY, O_WRONLY, O_RDWR - https://man7.org/linux/man-pages/man2/F_GETFL.2const.html.
FD_CLOEXEC is supposed to be altered by F_SETFD, not by F_SETFL - https://man7.org/linux/man-pages/man2/f_setfd.2const.html and it is not a command by its own (second parameter of fctnl) but a parameter (third parameter).
Actually the definitions in usr/include/bits/fcntl-linux.h are:
fcntl-linux.h:#define FD_CLOEXEC 1 /* Actually anything with low bit set goes */
fcntl-linux.h:#define F_GETFD 1 /* Get file descriptor flags. */
so
int cmd=FD_CLOEXEC|F_SETFL;
ret= fcntl(fd,cmd,O_RDWR | O_NOCTTY | O_NONBLOCK);
was doing
ret= fcntl(fd, F_GETFD | F_SETFL ,O_RDWR | O_NOCTTY | O_NONBLOCK);1 parent 9cc4e2e commit 21975be
1 file changed
+0
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4422 | 4422 | | |
4423 | 4423 | | |
4424 | 4424 | | |
4425 | | - | |
4426 | 4425 | | |
4427 | 4426 | | |
4428 | 4427 | | |
4429 | 4428 | | |
4430 | 4429 | | |
4431 | 4430 | | |
4432 | 4431 | | |
4433 | | - | |
4434 | | - | |
4435 | | - | |
4436 | | - | |
4437 | 4432 | | |
4438 | 4433 | | |
4439 | 4434 | | |
| |||
0 commit comments