#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <time.h>
#include <ctype.h>
#include <errno.h>
#include <sys/stat.h>
/* Read from socket and feed the hiredis reader. */
do {
nread = read(fd,ibuf,sizeof(ibuf));
- if (nread == -1 && errno != EAGAIN) {
+ if (nread == -1 && errno != EAGAIN && errno != EINTR) {
fprintf(stderr, "Error reading from the server: %s\n",
strerror(errno));
exit(1);
ssize_t nwritten = write(fd,obuf+obuf_pos,obuf_len);
if (nwritten == -1) {
- fprintf(stderr, "Error writing to the server: %s\n",
- strerror(errno));
- exit(1);
+ if (errno != EAGAIN && errno != EINTR) {
+ fprintf(stderr, "Error writing to the server: %s\n",
+ strerror(errno));
+ exit(1);
+ } else {
+ nwritten = 0;
+ }
}
obuf_len -= nwritten;
obuf_pos += nwritten;