aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/wget.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 3f3d3a0c9..fa4d21afd 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -248,7 +248,7 @@ struct globals {
* With 512 byte buffer, it was measured to be
* an order of magnitude slower than with big one.
*/
- char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(sizeof(long));
+ char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(16);
} FIX_ALIASING;
#define G (*ptr_to_globals)
#define INIT_G() do { \
@@ -388,9 +388,6 @@ static void set_alarm(void)
* is_ip_address() attempts to verify whether or not a string
* contains an IPv4 or IPv6 address (vs. an FQDN). The result
* of inet_pton() can be used to determine this.
- *
- * TODO add proper error checking when inet_pton() returns -1
- * (some form of system error has occurred, and errno is set)
*/
static int is_ip_address(const char *string)
{
@@ -1012,6 +1009,15 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
*/
}
+ /* Draw full bar and free its resources */
+ G.chunked = 0; /* makes it show 100% even for chunked download */
+ G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */
+ progress_meter(PROGRESS_END);
+ if (G.content_len != 0) {
+ bb_perror_msg_and_die("connection closed prematurely");
+ /* GNU wget says "DATE TIME (NN MB/s) - Connection closed at byte NNN. Retrying." */
+ }
+
/* If -c failed, we restart from the beginning,
* but we do not truncate file then, we do it only now, at the end.
* This lets user to ^C if his 99% complete 10 GB file download
@@ -1023,10 +1029,6 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
ftruncate(G.output_fd, pos);
}
- /* Draw full bar and free its resources */
- G.chunked = 0; /* makes it show 100% even for chunked download */
- G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */
- progress_meter(PROGRESS_END);
if (!(option_mask32 & WGET_OPT_QUIET)) {
if (G.output_fd == 1)
fprintf(stderr, "written to stdout\n");