- revert incorrect select change
This commit is contained in:
parent
b25f98a417
commit
62f9856f54
@ -150,7 +150,7 @@ static int tftp(const int cmd, const struct hostent *host,
|
|||||||
socklen_t fromlen;
|
socklen_t fromlen;
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
int socketfd;
|
int socketfd;
|
||||||
int len, itmp;
|
int len;
|
||||||
int opcode = 0;
|
int opcode = 0;
|
||||||
int finished = 0;
|
int finished = 0;
|
||||||
int timeout = TFTP_NUM_RETRIES;
|
int timeout = TFTP_NUM_RETRIES;
|
||||||
@ -308,8 +308,8 @@ static int tftp(const int cmd, const struct hostent *host,
|
|||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_SET(socketfd, &rfds);
|
FD_SET(socketfd, &rfds);
|
||||||
|
|
||||||
itmp = select(socketfd + 1, &rfds, NULL, NULL, &tv);
|
switch (select(socketfd + 1, &rfds, NULL, NULL, &tv)) {
|
||||||
if (itmp == 1) {
|
case 1:
|
||||||
len = recvfrom(socketfd, buf, tftp_bufsize, 0,
|
len = recvfrom(socketfd, buf, tftp_bufsize, 0,
|
||||||
(struct sockaddr *) &from, &fromlen);
|
(struct sockaddr *) &from, &fromlen);
|
||||||
|
|
||||||
@ -330,8 +330,7 @@ static int tftp(const int cmd, const struct hostent *host,
|
|||||||
/* fall-through for bad packets! */
|
/* fall-through for bad packets! */
|
||||||
/* discard the packet - treat as timeout */
|
/* discard the packet - treat as timeout */
|
||||||
timeout = TFTP_NUM_RETRIES;
|
timeout = TFTP_NUM_RETRIES;
|
||||||
|
case 0:
|
||||||
} else if (itmp == 0) {
|
|
||||||
bb_error_msg("timeout");
|
bb_error_msg("timeout");
|
||||||
|
|
||||||
timeout--;
|
timeout--;
|
||||||
@ -340,8 +339,7 @@ static int tftp(const int cmd, const struct hostent *host,
|
|||||||
bb_error_msg("last timeout");
|
bb_error_msg("last timeout");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
} else {
|
|
||||||
bb_perror_msg("select");
|
bb_perror_msg("select");
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user