aboutsummaryrefslogtreecommitdiff
path: root/networking/ftpgetput.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 12:49:22 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 12:49:22 +0000
commit1385899416a4396385ad421ae1f532be7103738a (patch)
treefc4d14a910593d1235318bb36abe5e9f72d2039e /networking/ftpgetput.c
parent5625415085e68ac5e150f54e685417c866620d76 (diff)
downloadbusybox-w32-1385899416a4396385ad421ae1f532be7103738a.tar.gz
busybox-w32-1385899416a4396385ad421ae1f532be7103738a.tar.bz2
busybox-w32-1385899416a4396385ad421ae1f532be7103738a.zip
attempt to regularize atoi mess.
Diffstat (limited to 'networking/ftpgetput.c')
-rw-r--r--networking/ftpgetput.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index 492854153..902528f93 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -42,15 +42,15 @@ static int ftpcmd(const char *s1, const char *s2, FILE *stream, char *buf)
42 char *buf_ptr; 42 char *buf_ptr;
43 43
44 if (fgets(buf, 510, stream) == NULL) { 44 if (fgets(buf, 510, stream) == NULL) {
45 bb_perror_msg_and_die("fgets()"); 45 bb_perror_msg_and_die("fgets");
46 } 46 }
47 buf_ptr = strstr(buf, "\r\n"); 47 buf_ptr = strstr(buf, "\r\n");
48 if (buf_ptr) { 48 if (buf_ptr) {
49 *buf_ptr = '\0'; 49 *buf_ptr = '\0';
50 } 50 }
51 } while (! isdigit(buf[0]) || buf[3] != ' '); 51 } while (!isdigit(buf[0]) || buf[3] != ' ');
52 52
53 return atoi(buf); 53 return xatou(buf);
54} 54}
55 55
56static int xconnect_ftpdata(ftp_host_info_t *server, const char *buf) 56static int xconnect_ftpdata(ftp_host_info_t *server, const char *buf)
@@ -60,14 +60,14 @@ static int xconnect_ftpdata(ftp_host_info_t *server, const char *buf)
60 60
61 buf_ptr = strrchr(buf, ','); 61 buf_ptr = strrchr(buf, ',');
62 *buf_ptr = '\0'; 62 *buf_ptr = '\0';
63 port_num = atoi(buf_ptr + 1); 63 port_num = xatoul_range(buf_ptr + 1, 0, 255);
64 64
65 buf_ptr = strrchr(buf, ','); 65 buf_ptr = strrchr(buf, ',');
66 *buf_ptr = '\0'; 66 *buf_ptr = '\0';
67 port_num += atoi(buf_ptr + 1) * 256; 67 port_num += xatoul_range(buf_ptr + 1, 0, 255) * 256;
68 68
69 server->s_in->sin_port=htons(port_num); 69 server->s_in->sin_port = htons(port_num);
70 return(xconnect(server->s_in)); 70 return xconnect(server->s_in);
71} 71}
72 72
73static FILE *ftp_login(ftp_host_info_t *server) 73static FILE *ftp_login(ftp_host_info_t *server)