maxfd = dsi->socket + 1;
while (1) {
+ if (dsi->socket == -1)
+ /* eg dsi_disconnect() might have disconnected us */
+ return -1;
FD_ZERO(&readfds);
FD_ZERO(&writefds);
goto exit;
}
if (errno == EAGAIN || errno == EWOULDBLOCK) {
+#if defined(SOLARIS) || defined(FREEBSD)
+ if (pos > offset) {
+ /* we actually have sent sth., adjust counters and keep trying */
+ len = pos - offset;
+ written += len;
+ offset = pos;
+ }
+#endif
if (dsi_peek(dsi)) {
/* can't go back to blocking mode, exit, the next read
will return with an error and afpd will die.