diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-16 20:00:24 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-16 20:00:24 +0100 |
commit | 12d97b66805f87e535962963e858fc2422ffdbc7 (patch) | |
tree | 10836c6158a05a505d8a7cb83313cc908e837a50 /networking | |
parent | 2a1571bfa003233470140a17be4ae4f0239f5a24 (diff) | |
download | busybox-w32-1_18_2.tar.gz busybox-w32-1_18_2.tar.bz2 busybox-w32-1_18_2.zip |
apply post-1.18.1 patches, bump version to 1.18.21_18_2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/httpd.c | 1 | ||||
-rw-r--r-- | networking/tftp.c | 39 |
2 files changed, 13 insertions, 27 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index fa42d9850..b8113a843 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -1522,6 +1522,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what) | |||
1522 | struct stat sb; | 1522 | struct stat sb; |
1523 | fstat(fd, &sb); | 1523 | fstat(fd, &sb); |
1524 | file_size = sb.st_size; | 1524 | file_size = sb.st_size; |
1525 | last_mod = sb.st_mtime; | ||
1525 | } else { | 1526 | } else { |
1526 | IF_FEATURE_HTTPD_GZIP(content_gzip = 0;) | 1527 | IF_FEATURE_HTTPD_GZIP(content_gzip = 0;) |
1527 | fd = open(url, O_RDONLY); | 1528 | fd = open(url, O_RDONLY); |
diff --git a/networking/tftp.c b/networking/tftp.c index 04c8f0ebb..fcd933f6a 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -105,39 +105,22 @@ struct BUG_G_too_big { | |||
105 | #define error_pkt_str (error_pkt + 4) | 105 | #define error_pkt_str (error_pkt + 4) |
106 | 106 | ||
107 | #if ENABLE_FEATURE_TFTP_PROGRESS_BAR | 107 | #if ENABLE_FEATURE_TFTP_PROGRESS_BAR |
108 | /* SIGALRM logic nicked from the wget applet */ | 108 | static void tftp_progress_update(void) |
109 | static void progress_meter(int flag) | ||
110 | { | 109 | { |
111 | /* We can be called from signal handler */ | ||
112 | int save_errno = errno; | ||
113 | |||
114 | if (flag == -1) { /* first call to progress_meter */ | ||
115 | bb_progress_init(&G.pmt); | ||
116 | } | ||
117 | |||
118 | bb_progress_update(&G.pmt, G.file, 0, G.pos, G.size); | 110 | bb_progress_update(&G.pmt, G.file, 0, G.pos, G.size); |
119 | |||
120 | if (flag == 0) { | ||
121 | /* last call to progress_meter */ | ||
122 | alarm(0); | ||
123 | bb_putchar_stderr('\n'); | ||
124 | } else { | ||
125 | if (flag == -1) { /* first call to progress_meter */ | ||
126 | signal_SA_RESTART_empty_mask(SIGALRM, progress_meter); | ||
127 | } | ||
128 | alarm(1); | ||
129 | } | ||
130 | |||
131 | errno = save_errno; | ||
132 | } | 111 | } |
133 | static void tftp_progress_init(void) | 112 | static void tftp_progress_init(void) |
134 | { | 113 | { |
135 | progress_meter(-1); | 114 | bb_progress_init(&G.pmt); |
115 | tftp_progress_update(); | ||
136 | } | 116 | } |
137 | static void tftp_progress_done(void) | 117 | static void tftp_progress_done(void) |
138 | { | 118 | { |
139 | if (G.pmt.inited) | 119 | if (G.pmt.inited) { |
140 | progress_meter(0); | 120 | tftp_progress_update(); |
121 | bb_putchar_stderr('\n'); | ||
122 | G.pmt.inited = 0; | ||
123 | } | ||
141 | } | 124 | } |
142 | #else | 125 | #else |
143 | # define tftp_progress_init() ((void)0) | 126 | # define tftp_progress_init() ((void)0) |
@@ -460,9 +443,10 @@ static int tftp_protocol( | |||
460 | xsendto(socket_fd, xbuf, send_len, &peer_lsa->u.sa, peer_lsa->len); | 443 | xsendto(socket_fd, xbuf, send_len, &peer_lsa->u.sa, peer_lsa->len); |
461 | 444 | ||
462 | #if ENABLE_FEATURE_TFTP_PROGRESS_BAR | 445 | #if ENABLE_FEATURE_TFTP_PROGRESS_BAR |
463 | if (ENABLE_TFTP && remote_file) { /* tftp */ | 446 | if (ENABLE_TFTP && remote_file) /* tftp */ |
464 | G.pos = (block_nr - 1) * (uoff_t)blksize; | 447 | G.pos = (block_nr - 1) * (uoff_t)blksize; |
465 | } | 448 | if (G.pmt.inited) |
449 | tftp_progress_update(); | ||
466 | #endif | 450 | #endif |
467 | /* Was it final ACK? then exit */ | 451 | /* Was it final ACK? then exit */ |
468 | if (finished && (opcode == TFTP_ACK)) | 452 | if (finished && (opcode == TFTP_ACK)) |
@@ -479,6 +463,7 @@ static int tftp_protocol( | |||
479 | case 0: | 463 | case 0: |
480 | retries--; | 464 | retries--; |
481 | if (retries == 0) { | 465 | if (retries == 0) { |
466 | tftp_progress_done(); | ||
482 | bb_error_msg("timeout"); | 467 | bb_error_msg("timeout"); |
483 | goto ret; /* no err packet sent */ | 468 | goto ret; /* no err packet sent */ |
484 | } | 469 | } |