4 ssize_t SockRead(int fd, void *buf, size_t count)
10 while (nleft > 0) { /* repeat until no left */
11 if ( (nread = read(fd, buf, nleft)) < 0) {
12 if (errno == EINTR) { /* if interrupted by system call */
13 continue; /* repeat the loop */
15 return(nread); /* otherwise exit */
17 } else if (nread == 0) { /* EOF */
18 break; /* break loop here */
20 nleft -= nread; /* set left to read */
21 buf +=nread; /* set pointer */
23 return (count - nleft);