| 41 | |
| 42 | |
| 43 | static int setSocketNonBlock(int fd) { |
| 44 | int flags = fcntl(fd, F_GETFL, 0); |
| 45 | if (flags < 0) { |
| 46 | perr("setSocketNonBlock fcntl F_GETFL failed, fd:%d, flag:%d", fd, flags); |
| 47 | return -1; |
| 48 | } |
| 49 | int ret = fcntl(fd, F_SETFL, flags | O_NONBLOCK); |
| 50 | if (ret < 0) { |
| 51 | perr("setSocketNonBlock fcntl F_SETFL failed, fd:%d, ret:%d ", fd, ret); |
| 52 | return -2; |
| 53 | } |
| 54 | return 0; |
| 55 | } |
| 56 | |
| 57 | static int checkCanWrite(int fd) { |
| 58 | fd_set fdset; |
nothing calls this directly
no outgoing calls
no test coverage detected