The debuginfod client cache uses empty files to indicate that a download
was unsuccessful and should not be attempted again.

Commit 5527216460c61 skips the creation of empty files when a downloaded
is cancelled by the user.  This works by setting
client->progressfn_cancel to true when progressfn returns a non-zero value.

Commit d47d93b1049ec appears to have accidentally removed this setting of
client->progressfn_cancel.

Restore setting client->progressfn_cancel to true when progressfn
returns a non-zero value.  Also set client->progressfn_cancel to false
at the beginning of debuginfod_find_metadata to avoid previous
cancellations affecting the current metadata query.

Signed-off-by: Aaron Merey <ame...@redhat.com>
---
 debuginfod/debuginfod-client.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 3c3a88d1..f7d12561 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1182,7 +1182,10 @@ perform_queries(CURLM *curlm, CURL **target_handle, 
struct handle_data *data, de
                 }
               
               if ((*c->progressfn) (c, pa, dl_size == -1 ? 0 : dl_size))
-                break;
+               {
+                 c->progressfn_cancel = true;
+                 break;
+               }
             }
         }
       /* Check to see if we are downloading something which exceeds maxsize, 
if set.*/
@@ -2734,6 +2737,8 @@ int debuginfod_find_metadata (debuginfod_client *client,
   int rc = 0, r;
   int vfd = client->verbose_fd;
   struct handle_data *data = NULL;
+
+  client->progressfn_cancel = false;
   
   json_object *json_metadata = json_object_new_object();
   json_bool json_metadata_complete = true;
-- 
2.50.1

Reply via email to