1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Bug 770: Don't close fd when resuming download

I added this bug last night.  continue_download_do() passed the
file descriptor to transform_codw_to_cmdw(), which saved it, but
continue_download_do() then closed it.
This commit is contained in:
Kalle Olavi Niemitalo 2009-07-19 13:41:44 +03:00 committed by Kalle Olavi Niemitalo
parent 075171c2c8
commit 89c7e57890

View File

@ -1091,7 +1091,10 @@ transform_codw_to_cmdw(struct terminal *term, int fd,
struct type_query *type_query = codw_hop->type_query; struct type_query *type_query = codw_hop->type_query;
struct cmdw_hop *cmdw_hop = mem_calloc(1, sizeof(*cmdw_hop)); struct cmdw_hop *cmdw_hop = mem_calloc(1, sizeof(*cmdw_hop));
if (!cmdw_hop) return; if (!cmdw_hop) {
close(fd);
return;
}
cmdw_hop->ses = type_query->ses; cmdw_hop->ses = type_query->ses;
cmdw_hop->download_uri = get_uri_reference(type_query->uri); cmdw_hop->download_uri = get_uri_reference(type_query->uri);
@ -1123,6 +1126,7 @@ continue_download_do(struct terminal *term, int fd, void *data,
if (resume & DOWNLOAD_RESUME_SELECTED) { if (resume & DOWNLOAD_RESUME_SELECTED) {
transform_codw_to_cmdw(term, fd, codw_hop, resume); transform_codw_to_cmdw(term, fd, codw_hop, resume);
fd = -1; /* ownership transfer */
goto cancel; goto cancel;
} }