mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-27 01:26:07 +00:00
Fix CID 1134520
This commit is contained in:
parent
1a6dedb5e8
commit
e483309b9b
@ -385,13 +385,18 @@ R_API RSocket *r_socket_accept(RSocket *s) {
|
||||
}
|
||||
|
||||
R_API int r_socket_block_time (RSocket *s, int block, int sec) {
|
||||
int ret;
|
||||
if (!s) return R_FALSE;
|
||||
#if __UNIX__
|
||||
{
|
||||
int flags = fcntl (s->fd, F_GETFL, 0);
|
||||
fcntl (s->fd, F_SETFL, block?
|
||||
if (flags < 0)
|
||||
return R_FALSE;
|
||||
ret = fcntl (s->fd, F_SETFL, block?
|
||||
(flags & ~O_NONBLOCK):
|
||||
(flags | O_NONBLOCK));
|
||||
if (ret < 0)
|
||||
return R_FALSE;
|
||||
}
|
||||
#elif __WINDOWS__
|
||||
// HACK: nonblocking io on w32 behaves strange
|
||||
|
Loading…
x
Reference in New Issue
Block a user