| 131 | } |
| 132 | |
| 133 | bool jsonrpc_sync_read(struct jsonrpc_io *json_in, int infd) |
| 134 | { |
| 135 | int r; |
| 136 | |
| 137 | /* Make sure there's more room */ |
| 138 | membuf_prepare_space(&json_in->membuf, READ_CHUNKSIZE); |
| 139 | |
| 140 | /* Try to read more. */ |
| 141 | r = read(infd, |
| 142 | membuf_space(&json_in->membuf), |
| 143 | membuf_num_space(&json_in->membuf)); |
| 144 | if (r < 0) |
| 145 | return false; |
| 146 | if (r == 0) { |
| 147 | errno = 0; |
| 148 | return false; |
| 149 | } |
| 150 | json_in->bytes_read = r; |
| 151 | return true; |
| 152 | } |
no outgoing calls
no test coverage detected