Skip to content

eBPF-based security platform

bpm: report a failed download write as itself

Daniel Borkmann132feb590d49
diff --git a/util/bpm_oci.c b/util/bpm_oci.c
index 794a2e73..1ceb5fe2 100644
--- a/util/bpm_oci.c
+++ b/util/bpm_oci.c
@@ -815,9 +815,10 @@ int bpm_oci_get_file(struct bpm_oci_client *c, const char *url,
rc = curl_once(c, "GET", url, accept, auth, &r, &sink, true);
}
}
+ /* A failed write ends the transfer too; it, not the transfer, is the cause. */
if (sink.overflow)
rc = -EFBIG;
- if (!rc && sink.err)
+ else if (sink.err)
rc = sink.err;
if (!rc && (r.status < 200 || r.status >= 300))
rc = r.status == 404 ? -ENOENT : -EACCES;