svn commit: trunk/busybox/networking

aldot at busybox.net aldot at busybox.net
Sat Jun 10 14:33:00 UTC 2006


Author: aldot
Date: 2006-06-10 07:32:56 -0700 (Sat, 10 Jun 2006)
New Revision: 15357

Log:
- revert incorrect select change


Modified:
   trunk/busybox/networking/tftp.c


Changeset:
Modified: trunk/busybox/networking/tftp.c
===================================================================
--- trunk/busybox/networking/tftp.c	2006-06-10 14:22:01 UTC (rev 15356)
+++ trunk/busybox/networking/tftp.c	2006-06-10 14:32:56 UTC (rev 15357)
@@ -150,7 +150,7 @@
 	socklen_t fromlen;
 	fd_set rfds;
 	int socketfd;
-	int len, itmp;
+	int len;
 	int opcode = 0;
 	int finished = 0;
 	int timeout = TFTP_NUM_RETRIES;
@@ -308,8 +308,8 @@
 			FD_ZERO(&rfds);
 			FD_SET(socketfd, &rfds);
 
-			itmp = select(socketfd + 1, &rfds, NULL, NULL, &tv);
-			if (itmp == 1) {
+			switch (select(socketfd + 1, &rfds, NULL, NULL, &tv)) {
+			case 1:
 				len = recvfrom(socketfd, buf, tftp_bufsize, 0,
 							   (struct sockaddr *) &from, &fromlen);
 
@@ -330,8 +330,7 @@
 				/* fall-through for bad packets! */
 				/* discard the packet - treat as timeout */
 				timeout = TFTP_NUM_RETRIES;
-
-			} else if (itmp == 0) {
+			case 0:
 				bb_error_msg("timeout");
 
 				timeout--;
@@ -340,8 +339,7 @@
 					bb_error_msg("last timeout");
 				}
 				break;
-
-			} else {
+			default:
 				bb_perror_msg("select");
 				len = -1;
 			}




More information about the busybox-cvs mailing list