@@ -, +, @@ --- configure.ac | 3 +++ src/ar.c | 8 +++++++- src/strip.c | 18 ++++++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) --- a/configure.ac +++ a/configure.ac @@ -268,6 +268,9 @@ AC_CHECK_FUNCS_ONCE([__mempcpy]) dnl Chekf for obstack_printf AC_CHECK_FUNCS_ONCE([obstack_printf]) +dnl Check for futimes +AC_CHECK_FUNC([futimes]) + dnl The directories with content. dnl Documentation. --- a/src/ar.c +++ a/src/ar.c @@ -693,7 +693,13 @@ do_oper_extract (int oper, const char *arfname, char **argv, int argc, tv[1].tv_sec = arhdr->ar_date; tv[1].tv_usec = 0; - if (unlikely (futimes (xfd, tv) != 0)) + int success; +#ifdef HAVE_FUTIMES + success = futimes (xfd, tv); +#else + success = utimes (arhdr->ar_name, tv); +#endif + if (unlikely (success != 0)) { error (0, errno, gettext ("cannot change modification time of %s"), --- a/src/strip.c +++ a/src/strip.c @@ -2061,10 +2061,17 @@ while computing checksum for debug information")); close (debug_fd); } + int success; +#ifdef HAVE_FUTIMES + success = futimes (fd, tvp); +#else + success = utimes (fname, tvp); +#endif + /* If requested, preserve the timestamp. */ if (tvp != NULL) { - if (futimes (fd, tvp) != 0) + if (success != 0) { error (0, errno, gettext ("\ cannot set access and modification date of '%s'"), @@ -2119,9 +2126,16 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, INTERNAL_ERROR (fname); } + int success; +#ifdef HAVE_FUTIMES + success = futimes (fd, tvp); +#else + success = utimes (fname, tvp); +#endif + if (tvp != NULL) { - if (unlikely (futimes (fd, tvp) != 0)) + if (unlikely (success != 0)) { error (0, errno, gettext ("\ cannot set access and modification date of '%s'"), fname); --