timeradd(&start, &delta, &end);
}
+ FD_ZERO(&fds);
+ FD_SET(port->fd, &fds);
+
/* Loop until we have written the requested number of bytes. */
while (bytes_written < count) {
/* Wait until space is available. */
- FD_ZERO(&fds);
- FD_SET(port->fd, &fds);
if (timeout_ms) {
gettimeofday(&now, NULL);
if (timercmp(&now, &end, >)) {
timeradd(&start, &delta, &end);
}
+ FD_ZERO(&fds);
+ FD_SET(port->fd, &fds);
+
/* Loop until we have the requested number of bytes. */
while (bytes_read < count) {
/* Wait until data is available. */
- FD_ZERO(&fds);
- FD_SET(port->fd, &fds);
if (timeout_ms) {
gettimeofday(&now, NULL);
if (timercmp(&now, &end, >))