diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-08 17:54:47 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-08 17:54:47 +0000 |
commit | 7039a66b58706457c7423de60556e04545432943 (patch) | |
tree | a512daebc3674c819766664c8ea17d41ef7fef02 /networking/ftpgetput.c | |
parent | 1385899416a4396385ad421ae1f532be7103738a (diff) | |
download | busybox-w32-7039a66b58706457c7423de60556e04545432943.tar.gz busybox-w32-7039a66b58706457c7423de60556e04545432943.tar.bz2 busybox-w32-7039a66b58706457c7423de60556e04545432943.zip |
correct largefile support, add comments about it.
Diffstat (limited to 'networking/ftpgetput.c')
-rw-r--r-- | networking/ftpgetput.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 902528f93..5d13e289b 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c | |||
@@ -104,9 +104,11 @@ static FILE *ftp_login(ftp_host_info_t *server) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | #if !ENABLE_FTPGET | 106 | #if !ENABLE_FTPGET |
107 | #define ftp_receive 0 | 107 | int ftp_receive(ftp_host_info_t *server, FILE *control_stream, |
108 | const char *local_path, char *server_path); | ||
108 | #else | 109 | #else |
109 | static int ftp_receive(ftp_host_info_t *server, FILE *control_stream, | 110 | static |
111 | int ftp_receive(ftp_host_info_t *server, FILE *control_stream, | ||
110 | const char *local_path, char *server_path) | 112 | const char *local_path, char *server_path) |
111 | { | 113 | { |
112 | char buf[512]; | 114 | char buf[512]; |
@@ -122,10 +124,8 @@ static int ftp_receive(ftp_host_info_t *server, FILE *control_stream, | |||
122 | fd_data = xconnect_ftpdata(server, buf); | 124 | fd_data = xconnect_ftpdata(server, buf); |
123 | 125 | ||
124 | if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) { | 126 | if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) { |
125 | unsigned long value=filesize; | 127 | if (SAFE_STRTOOFF(buf + 4, &filesize)) |
126 | if (safe_strtoul(buf + 4, &value)) | ||
127 | bb_error_msg_and_die("SIZE error: %s", buf + 4); | 128 | bb_error_msg_and_die("SIZE error: %s", buf + 4); |
128 | filesize = value; | ||
129 | } else { | 129 | } else { |
130 | filesize = -1; | 130 | filesize = -1; |
131 | do_continue = 0; | 131 | do_continue = 0; |
@@ -139,7 +139,7 @@ static int ftp_receive(ftp_host_info_t *server, FILE *control_stream, | |||
139 | if (do_continue) { | 139 | if (do_continue) { |
140 | struct stat sbuf; | 140 | struct stat sbuf; |
141 | if (lstat(local_path, &sbuf) < 0) { | 141 | if (lstat(local_path, &sbuf) < 0) { |
142 | bb_perror_msg_and_die("fstat()"); | 142 | bb_perror_msg_and_die("lstat"); |
143 | } | 143 | } |
144 | if (sbuf.st_size > 0) { | 144 | if (sbuf.st_size > 0) { |
145 | beg_range = sbuf.st_size; | 145 | beg_range = sbuf.st_size; |
@@ -149,7 +149,7 @@ static int ftp_receive(ftp_host_info_t *server, FILE *control_stream, | |||
149 | } | 149 | } |
150 | 150 | ||
151 | if (do_continue) { | 151 | if (do_continue) { |
152 | sprintf(buf, "REST %ld", (long)beg_range); | 152 | sprintf(buf, "REST "OFF_FMT, beg_range); |
153 | if (ftpcmd(buf, NULL, control_stream, buf) != 350) { | 153 | if (ftpcmd(buf, NULL, control_stream, buf) != 350) { |
154 | do_continue = 0; | 154 | do_continue = 0; |
155 | } else { | 155 | } else { |
@@ -191,9 +191,11 @@ static int ftp_receive(ftp_host_info_t *server, FILE *control_stream, | |||
191 | #endif | 191 | #endif |
192 | 192 | ||
193 | #if !ENABLE_FTPPUT | 193 | #if !ENABLE_FTPPUT |
194 | #define ftp_send 0 | 194 | int ftp_send(ftp_host_info_t *server, FILE *control_stream, |
195 | const char *server_path, char *local_path); | ||
195 | #else | 196 | #else |
196 | static int ftp_send(ftp_host_info_t *server, FILE *control_stream, | 197 | static |
198 | int ftp_send(ftp_host_info_t *server, FILE *control_stream, | ||
197 | const char *server_path, char *local_path) | 199 | const char *server_path, char *local_path) |
198 | { | 200 | { |
199 | struct stat sbuf; | 201 | struct stat sbuf; |