From: Max Filippov Date: Mon, 4 May 2015 17:17:51 +0000 (+0300) Subject: Replace futimes with futimens. X-Git-Tag: elfutils-0.162~76 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c4aa0ef998191ed828a37190dc179b91649938a;p=platform%2Fupstream%2Felfutils.git Replace futimes with futimens. futimes is not standard function, and it's not available in uClibc. Use futimens which is POSIX. Suggested-by: Mike Frysinger Signed-off-by: Max Filippov --- diff --git a/src/ChangeLog b/src/ChangeLog index 957eeb3..a7cdc3e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2015-05-04 Max Filippov + * ar.c (do_oper_extract): Replace struct timeval with struct timespec + and futimes with futimens. + * strip.c (process_file): Replace struct timeval with struct timespec. + (handle_elf, handle_ar): Replace struct timeval with struct timespec + in prototype. Replace futimes with futimens. + +2015-05-04 Max Filippov + * addr2line.c (main): Drop mtrace() call and #include . * ar.c: Likewise. * ld.c: Likewise. diff --git a/src/ar.c b/src/ar.c index caed7f3..1320d07 100644 --- a/src/ar.c +++ b/src/ar.c @@ -679,13 +679,13 @@ do_oper_extract (int oper, const char *arfname, char **argv, int argc, if (preserve_dates) { - struct timeval tv[2]; + struct timespec tv[2]; tv[0].tv_sec = arhdr->ar_date; - tv[0].tv_usec = 0; + tv[0].tv_nsec = 0; tv[1].tv_sec = arhdr->ar_date; - tv[1].tv_usec = 0; + tv[1].tv_nsec = 0; - if (unlikely (futimes (xfd, tv) != 0)) + if (unlikely (futimens (xfd, tv) != 0)) { error (0, errno, gettext ("cannot change modification time of %s"), diff --git a/src/strip.c b/src/strip.c index e81001e..fd3920d 100644 --- a/src/strip.c +++ b/src/strip.c @@ -109,11 +109,11 @@ static int process_file (const char *fname); /* Handle one ELF file. */ static int handle_elf (int fd, Elf *elf, const char *prefix, - const char *fname, mode_t mode, struct timeval tvp[2]); + const char *fname, mode_t mode, struct timespec tvp[2]); /* Handle all files contained in the archive. */ static int handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, - struct timeval tvp[2]); + struct timespec tvp[2]); #define INTERNAL_ERROR(fname) \ error (EXIT_FAILURE, 0, gettext ("%s: INTERNAL ERROR %d (%s): %s"), \ @@ -302,7 +302,7 @@ process_file (const char *fname) now. We cannot use fstat() after opening the file since the open would change the access time. */ struct stat64 pre_st; - struct timeval tv[2]; + struct timespec tv[2]; again: if (preserve_dates) { @@ -314,8 +314,8 @@ process_file (const char *fname) /* If we have to preserve the timestamp, we need it in the format utimes() understands. */ - TIMESPEC_TO_TIMEVAL (&tv[0], &pre_st.st_atim); - TIMESPEC_TO_TIMEVAL (&tv[1], &pre_st.st_mtim); + tv[0] = pre_st.st_atim; + tv[1] = pre_st.st_mtim; } /* Open the file. */ @@ -388,7 +388,7 @@ process_file (const char *fname) static int handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - mode_t mode, struct timeval tvp[2]) + mode_t mode, struct timespec tvp[2]) { size_t prefix_len = prefix == NULL ? 0 : strlen (prefix); size_t fname_len = strlen (fname) + 1; @@ -2087,7 +2087,7 @@ while computing checksum for debug information")); /* If requested, preserve the timestamp. */ if (tvp != NULL) { - if (futimes (fd, tvp) != 0) + if (futimens (fd, tvp) != 0) { error (0, errno, gettext ("\ cannot set access and modification date of '%s'"), @@ -2106,7 +2106,7 @@ cannot set access and modification date of '%s'"), static int handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, - struct timeval tvp[2]) + struct timespec tvp[2]) { size_t prefix_len = prefix == NULL ? 0 : strlen (prefix); size_t fname_len = strlen (fname) + 1; @@ -2144,7 +2144,7 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, if (tvp != NULL) { - if (unlikely (futimes (fd, tvp) != 0)) + if (unlikely (futimens (fd, tvp) != 0)) { error (0, errno, gettext ("\ cannot set access and modification date of '%s'"), fname);