* Re: [PATCH 3/6] Fall back on utimes if futimes is not available
@ 2015-05-04 5:58 Mike Frysinger
0 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2015-05-04 5:58 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
On 04 May 2015 02:25, Max Filippov wrote:
> From: "Anthony G. Basile" <blueness@gentoo.org>
>
> We check if futimes is provided, and if it is not, we fall back
> on utimes which is POSIX.
imo we should use futimens everywhere. that is in POSIX.
-mike
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/6] Fall back on utimes if futimes is not available
@ 2015-05-05 19:26 Roland McGrath
0 siblings, 0 replies; 5+ messages in thread
From: Roland McGrath @ 2015-05-05 19:26 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 56 bytes --]
Almost exactly that is already on the portable branch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/6] Fall back on utimes if futimes is not available
@ 2015-05-04 14:16 Mark Wielaard
0 siblings, 0 replies; 5+ messages in thread
From: Mark Wielaard @ 2015-05-04 14:16 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]
On Mon, May 04, 2015 at 01:58:57AM -0400, Mike Frysinger wrote:
> On 04 May 2015 02:25, Max Filippov wrote:
> > From: "Anthony G. Basile" <blueness@gentoo.org>
> >
> > We check if futimes is provided, and if it is not, we fall back
> > on utimes which is POSIX.
>
> imo we should use futimens everywhere. that is in POSIX.
Agreed. Then we don't need any extra conditionals.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/6] Fall back on utimes if futimes is not available
@ 2015-05-04 12:58 Max Filippov
0 siblings, 0 replies; 5+ messages in thread
From: Max Filippov @ 2015-05-04 12:58 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 397 bytes --]
On Mon, May 4, 2015 at 8:58 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 04 May 2015 02:25, Max Filippov wrote:
>> From: "Anthony G. Basile" <blueness@gentoo.org>
>>
>> We check if futimes is provided, and if it is not, we fall back
>> on utimes which is POSIX.
>
> imo we should use futimens everywhere. that is in POSIX.
> -mike
Ok, I've changed that.
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/6] Fall back on utimes if futimes is not available
@ 2015-05-03 23:25 Max Filippov
0 siblings, 0 replies; 5+ messages in thread
From: Max Filippov @ 2015-05-03 23:25 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 3235 bytes --]
From: "Anthony G. Basile" <blueness@gentoo.org>
We check if futimes is provided, and if it is not, we fall back
on utimes which is POSIX.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
[Max: move futimes/utimes in strip.c into 'if (tvp != NULL)' blocks.]
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
ChangeLog | 4 ++++
configure.ac | 3 +++
src/ChangeLog | 6 ++++++
src/ar.c | 8 +++++++-
src/strip.c | 18 ++++++++++++++++--
5 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d3e46fc..89045ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2015-05-04 Anthony G. Basile <blueness@gentoo.org>
+ * configure.ac (futimes): Check if function exists.
+
+2015-05-04 Anthony G. Basile <blueness@gentoo.org>
+
* configure.ac (argp_LDADD): Check if libc has argp and set
argp_LDADD accordingly.
diff --git a/configure.ac b/configure.ac
index 68b7f5b..35dfa08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,6 +278,9 @@ else
fi
AC_SUBST([argp_LDADD])
+dnl Check for futimes
+AC_CHECK_FUNC([futimes])
+
dnl The directories with content.
dnl Documentation.
diff --git a/src/ChangeLog b/src/ChangeLog
index 957eeb3..2ee0d1d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-04 Anthony G. Basile <blueness@gentoo.org>
+
+ * ar.c (do_oper_extract): Use futimes or utimes depending on
+ HAVE_FUTIMES.
+ * strip.c (handle_elf, handle_ar): Likewise.
+
2015-05-04 Max Filippov <jcmvbkbc@gmail.com>
* addr2line.c (main): Drop mtrace() call and #include <mcheck.h>.
diff --git a/src/ar.c b/src/ar.c
index caed7f3..6882ced 100644
--- a/src/ar.c
+++ b/src/ar.c
@@ -685,7 +685,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"),
diff --git a/src/strip.c b/src/strip.c
index e81001e..07b7dc5 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -2087,7 +2087,14 @@ while computing checksum for debug information"));
/* If requested, preserve the timestamp. */
if (tvp != NULL)
{
- if (futimes (fd, tvp) != 0)
+ int success;
+#ifdef HAVE_FUTIMES
+ success = futimes (fd, tvp);
+#else
+ success = utimes (fname, tvp);
+#endif
+
+ if (success != 0)
{
error (0, errno, gettext ("\
cannot set access and modification date of '%s'"),
@@ -2144,7 +2151,14 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname,
if (tvp != NULL)
{
- if (unlikely (futimes (fd, tvp) != 0))
+ int success;
+#ifdef HAVE_FUTIMES
+ success = futimes (fd, tvp);
+#else
+ success = utimes (fname, tvp);
+#endif
+
+ if (unlikely (success != 0))
{
error (0, errno, gettext ("\
cannot set access and modification date of '%s'"), fname);
--
1.8.1.4
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-05-05 19:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 5:58 [PATCH 3/6] Fall back on utimes if futimes is not available Mike Frysinger
-- strict thread matches above, loose matches on Subject: below --
2015-05-05 19:26 Roland McGrath
2015-05-04 14:16 Mark Wielaard
2015-05-04 12:58 Max Filippov
2015-05-03 23:25 Max Filippov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).