| 364 | #endif |
| 365 | |
| 366 | static int socket_read(struct imap_socket *sock, char *buf, int len) |
| 367 | { |
| 368 | ssize_t n; |
| 369 | #ifndef NO_OPENSSL |
| 370 | if (sock->ssl) |
| 371 | n = SSL_read(sock->ssl, buf, len); |
| 372 | else |
| 373 | #endif |
| 374 | n = xread(sock->fd[0], buf, len); |
| 375 | if (n <= 0) { |
| 376 | socket_perror("read", sock, n); |
| 377 | close(sock->fd[0]); |
| 378 | close(sock->fd[1]); |
| 379 | sock->fd[0] = sock->fd[1] = -1; |
| 380 | } |
| 381 | return n; |
| 382 | } |
| 383 | |
| 384 | static int socket_write(struct imap_socket *sock, const char *buf, int len) |
| 385 | { |
no test coverage detected