summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debuginfod/ChangeLog5
-rw-r--r--debuginfod/debuginfod-client.c15
2 files changed, 20 insertions, 0 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index c8c56232..f13c28d5 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,5 +1,10 @@
2023-03-30 Jan Alexander Steffens (heftig) <heftig@archlinux.org>
+ * debuginfod-client.c (update_atime): New function.
+ (extract_section, debuginfod_query_server): Call it.
+
+2023-03-30 Jan Alexander Steffens (heftig) <heftig@archlinux.org>
+
* debuginfod-client.c (debuginfod_query_server): Don't modify
atime unintentionally.
* debuginfod.cxx (extract_section, handle_buildid_r_match): Ditto.
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 7d0b153e..5bb79524 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -618,6 +618,19 @@ path_escape (const char *src, char *dest)
dest[q] = '\0';
}
+/* Attempt to update the atime */
+static void
+update_atime (int fd)
+{
+ struct timespec tvs[2];
+
+ tvs[0].tv_sec = tvs[1].tv_sec = 0;
+ tvs[0].tv_nsec = UTIME_NOW;
+ tvs[1].tv_nsec = UTIME_OMIT;
+
+ (void) futimens (fd, tvs); /* best effort */
+}
+
/* Attempt to read an ELF/DWARF section with name SECTION from FD and write
it to a separate file in the debuginfod cache. If successful the absolute
path of the separate file containing SECTION will be stored in USR_PATH.
@@ -761,6 +774,7 @@ extract_section (int fd, const char *section, char *fd_path, char **usr_path)
*usr_path = sec_path;
else
free (sec_path);
+ update_atime(fd);
rc = sec_fd;
goto out2;
}
@@ -1098,6 +1112,7 @@ debuginfod_query_server (debuginfod_client *c,
}
}
/* Success!!!! */
+ update_atime(fd);
rc = fd;
goto out;
}