]> git.tdb.fi Git - libs/net.git/commitdiff
Fix a flag handling bug in Socket::Private::set_block
authorMikko Rasa <tdb@tdb.fi>
Tue, 5 Dec 2017 06:39:14 +0000 (08:39 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 5 Dec 2017 06:39:14 +0000 (08:39 +0200)
source/net/unix/socket.cpp

index 02ef7c3c06c4999e7d62ebe838427918271f6d99..46c80b7a59000d4b36c788b7c566c5cddb570c15 100644 (file)
@@ -37,7 +37,7 @@ void Socket::set_platform_events(unsigned)
 void Socket::Private::set_block(bool b)
 {
        int flags = fcntl(handle, F_GETFL);
-       fcntl(handle, F_SETFL, (flags&O_NONBLOCK)|(b?0:O_NONBLOCK));
+       fcntl(handle, F_SETFL, (flags&~O_NONBLOCK)|(b?0:O_NONBLOCK));
 }
 
 int Socket::Private::set_option(int level, int optname, const void *optval, socklen_t optlen)