Skip to content

Commit 8458ae9

Browse files
committed
Many system calls will report the EINTR error code if a signal occurred while the system call was in progress. No error actually occurred, it's just reported that way because the system isn't able to resume the system call automatically. This coding pattern simply retries the system call when this happens, to ignore the interrupt.
1 parent a483557 commit 8458ae9

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

C/sqcloud.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,7 @@ static ssize_t internal_socket_read_nbytes (int fd, void *tlsp, char *buffer, ss
14241424
#else
14251425
nread = readsocket(fd, buffer + total_read, len - total_read);
14261426
#endif
1427+
if (nread == -1 && errno == EINTR) continue;
14271428
total_read += nread;
14281429

14291430
if (nread <= 0) return nread;

0 commit comments

Comments
 (0)