- if ((res = write(f, buf, len)) <= 0) {
- if(!tried && errno==EAGAIN) {
- /* Assume the connection will work some time in
- * the future, but don't run away with CPU time
- * in case it doesn't */
- fd_set set;
- struct timeval tv;
-
- DEBUG("Write failed, trying again");
- tried=TRUE;
- FD_ZERO(&set);
- FD_SET(f, &set);
- tv.tv_sec=30;
- tv.tv_usec=0;
- select(f+1, NULL, &set, NULL, &tv);
- } else {
- err("Send failed: %m");
- }
- } else {
- len -= res;
- buf += res;
- tried=FALSE;
- }
+ if ((res = write(f, buf, len)) <= 0)
+ err("Send failed: %m");
+ len -= res;
+ buf += res;