From 89c7e57890c534f95f7139fa682c2675ed9ee3b5 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 19 Jul 2009 13:41:44 +0300 Subject: [PATCH] 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. --- src/session/download.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/session/download.c b/src/session/download.c index cc516a3a..8620f68a 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -1091,7 +1091,10 @@ transform_codw_to_cmdw(struct terminal *term, int fd, struct type_query *type_query = codw_hop->type_query; 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->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) { transform_codw_to_cmdw(term, fd, codw_hop, resume); + fd = -1; /* ownership transfer */ goto cancel; } -- 2.11.4.GIT