diff options
author | Denis Vlasenko | 2006-10-08 12:49:22 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-10-08 12:49:22 +0000 |
commit | 1385899416a4396385ad421ae1f532be7103738a (patch) | |
tree | fc4d14a910593d1235318bb36abe5e9f72d2039e /networking/ftpgetput.c | |
parent | 5625415085e68ac5e150f54e685417c866620d76 (diff) | |
download | busybox-1385899416a4396385ad421ae1f532be7103738a.zip busybox-1385899416a4396385ad421ae1f532be7103738a.tar.gz |
attempt to regularize atoi mess.
Diffstat (limited to 'networking/ftpgetput.c')
-rw-r--r-- | networking/ftpgetput.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 4928541..902528f 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) char *buf_ptr; if (fgets(buf, 510, stream) == NULL) { - bb_perror_msg_and_die("fgets()"); + bb_perror_msg_and_die("fgets"); } buf_ptr = strstr(buf, "\r\n"); if (buf_ptr) { *buf_ptr = '\0'; } - } while (! isdigit(buf[0]) || buf[3] != ' '); + } while (!isdigit(buf[0]) || buf[3] != ' '); - return atoi(buf); + return xatou(buf); } static 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) buf_ptr = strrchr(buf, ','); *buf_ptr = '\0'; - port_num = atoi(buf_ptr + 1); + port_num = xatoul_range(buf_ptr + 1, 0, 255); buf_ptr = strrchr(buf, ','); *buf_ptr = '\0'; - port_num += atoi(buf_ptr + 1) * 256; + port_num += xatoul_range(buf_ptr + 1, 0, 255) * 256; - server->s_in->sin_port=htons(port_num); - return(xconnect(server->s_in)); + server->s_in->sin_port = htons(port_num); + return xconnect(server->s_in); } static FILE *ftp_login(ftp_host_info_t *server) |