summaryrefslogtreecommitdiffstats
path: root/debuginfod
diff options
context:
space:
mode:
authorFrank Ch. Eigler <[email protected]>2024-01-15 21:21:24 -0500
committerFrank Ch. Eigler <[email protected]>2024-01-16 16:44:57 -0500
commit7554d41cd3784a321751c9ac430ad123f6c8cc1e (patch)
treeb9ec83a77fe5d4981ec9e71cceeea86786fc18ad /debuginfod
parentc1058da5a450e33e72b72abb53bc3ffd7f6b361b (diff)
PR31248: debuginfod_find_*: lseek to the front on returned fds
Previous code could return a fd that had its file-offset left at the place where libcurl last used it, namely at the end of the freshly downloaded file. Not good if a client just wants to read it right away! We now ensure (and document) that the fd is pointed to the beginning of the file. Signed-off-by: Frank Ch. Eigler <[email protected]>
Diffstat (limited to 'debuginfod')
-rw-r--r--debuginfod/debuginfod-client.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index dcf05031..0ee7db3d 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1771,6 +1771,8 @@ debuginfod_query_server (debuginfod_client *c,
/* PR27571: make cache files casually unwriteable; dirs are already 0700 */
(void) fchmod(fd, 0400);
+ /* PR31248: lseek back to beginning */
+ (void) lseek(fd, 0, SEEK_SET);
/* rename tmp->real */
rc = rename (target_cache_tmppath, target_cache_path);