Do not disturb old fd flags (eg O_APPEND) when setting nonblock.
PATCH 3/3 Do not disturb old fd flags (eg O_APPEND) when setting nonblock.
socket_set_nonblock should not unconditionally call fcntl(,F_SETFL,O_NONBLOCK) because that would clear other flags which might be intentionally set on the fd.
Signed-off-by Ian Jackson <[email protected]>
--- vl.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
vl.c +3 -1
@@ -2005,7 +2005,9 @@ static inline int send_all(int fd, const uint8_t *buf, int len1)void socket_set_nonblock (int fd) { -fcntl (fd,F_SETFL ,O_NONBLOCK ); +int f; + f =fcntl (fd,F_GETFL ); +fcntl (fd,F_SETFL , f |O_NONBLOCK ); }#endif /* !_WIN32 */
Signature · 1 line
1.4.4.4