]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
debuginfod: Replace futimes with futimens
authorJan Alexander Steffens (heftig) <heftig@archlinux.org>
Fri, 24 Mar 2023 00:48:03 +0000 (01:48 +0100)
committerFrank Ch. Eigler <fche@redhat.com>
Wed, 29 Mar 2023 20:43:54 +0000 (16:43 -0400)
Similar to what 8c4aa0ef998191ed828a37190dc179b91649938a did for ar and
strip, replace the non-standard futimes with the POSIX futimens.

Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
debuginfod/ChangeLog
debuginfod/debuginfod-client.c
debuginfod/debuginfod.cxx

index a8d264b5b06e0a24fffb93d14a6070331fc6847c..44dc3a1503f01c8b557a83ea9e3a1e235d617f7e 100644 (file)
@@ -1,3 +1,8 @@
+2023-03-29  Jan Alexander Steffens (heftig) <heftig@archlinux.org>
+
+       * debuginfod-client.c (debuginfod_query_server): s/futimes/futimens/
+       * debuginfod.cxx (extract_section, handle_buildid_r_match): Ditto.
+
 2023-03-29  lilydjwg  <lilydjwg@gmail.com>
 
        * debuginfod-client.c (debuginfod_query_server): Handle dl_size in
index d6d3f0dd0e7f4d9c116fbb7947e5f1ef0dc64270..4b6f93a79ff711dd63292f0d2580d7e37d21d283 100644 (file)
@@ -1721,10 +1721,10 @@ debuginfod_query_server (debuginfod_client *c,
   if (curl_res != CURLE_OK)
     mtime = time(NULL); /* fall back to current time */
 
-  struct timeval tvs[2];
+  struct timespec tvs[2];
   tvs[0].tv_sec = tvs[1].tv_sec = mtime;
-  tvs[0].tv_usec = tvs[1].tv_usec = 0;
-  (void) futimes (fd, tvs);  /* best effort */
+  tvs[0].tv_nsec = tvs[1].tv_nsec = 0;
+  (void) futimens (fd, tvs);  /* best effort */
 
   /* PR27571: make cache files casually unwriteable; dirs are already 0700 */
   (void) fchmod(fd, 0400);
index 99b1f2b9eee45fb16d4d3b45432f0331938c3387..b39c0591770cfbf9cdea3f919a38c21b7a0b26a2 100644 (file)
@@ -1635,13 +1635,12 @@ extract_section (int elf_fd, int64_t parent_mtime,
                throw libc_exception (errno, "cannot write to temporary file");
 
              /* Set mtime to be the same as the parent file's mtime.  */
-             struct timeval tvs[2];
+             struct timespec tvs[2];
              if (fstat (elf_fd, &fs) != 0)
                throw libc_exception (errno, "cannot fstat file");
 
-             tvs[0].tv_sec = tvs[1].tv_sec = fs.st_mtime;
-             tvs[0].tv_usec = tvs[1].tv_usec = 0;
-             (void) futimes (fd, tvs);
+             tvs[0] = tvs[1] = fs.st_mtim;
+             (void) futimens (fd, tvs);
 
              /* Add to fdcache.  */
              fdcache.intern (b_source, section, tmppath, data->d_size, true);
@@ -1951,10 +1950,10 @@ handle_buildid_r_match (bool internal_req_p,
 
       // Set the mtime so the fdcache file mtimes, even prefetched ones,
       // propagate to future webapi clients.
-      struct timeval tvs[2];
+      struct timespec tvs[2];
       tvs[0].tv_sec = tvs[1].tv_sec = archive_entry_mtime(e);
-      tvs[0].tv_usec = tvs[1].tv_usec = 0;
-      (void) futimes (fd, tvs);  /* best effort */
+      tvs[0].tv_nsec = tvs[1].tv_nsec = archive_entry_mtime_nsec(e);
+      (void) futimens (fd, tvs);  /* best effort */
 
       if (r != 0) // stage 3
         {