File libarchive-2.5.5_handle_ENOSYS_from_lutimes.patch of Package bsdtar
Index: cpio/cpio.c
===================================================================
--- cpio/cpio.c.orig 2008-07-03 07:28:35.000000000 +0200
+++ cpio/cpio.c 2008-10-27 17:31:56.806826303 +0100
@@ -35,6 +35,15 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/cpi
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_UTIME_H
+#include <sys/utime.h>
+#endif
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
@@ -662,7 +671,8 @@ restore_time(struct cpio *cpio, struct a
#endif
#ifdef HAVE_LUTIMES
- if (lutimes(name, times) != 0)
+ if ((lutimes(name, times) != 0) && (errno==ENOSYS) &&
+ (!S_ISLNK(archive_entry_mode(entry)) && utimes(name, times) != 0))
#else
if (!S_ISLNK(archive_entry_mode(entry)) && utimes(name, times) != 0)
#endif
Index: libarchive/archive_write_disk.c
===================================================================
--- libarchive/archive_write_disk.c.orig 2008-06-27 09:08:58.000000000 +0200
+++ libarchive/archive_write_disk.c 2008-10-27 17:42:24.514385393 +0100
@@ -1097,7 +1097,9 @@ _archive_write_close(struct archive *_a)
times[0].tv_sec = p->atime;
times[0].tv_usec = p->atime_nanos / 1000;
#ifdef HAVE_LUTIMES
- lutimes(p->name, times);
+ if ((lutimes(p->name, times) != 0) && (errno==ENOSYS) && (!S_ISLNK(p->mode))) {
+ utimes(p->name, times);
+ }
#else
utimes(p->name, times);
#endif
@@ -1638,7 +1640,8 @@ set_time(struct archive_write_disk *a)
#endif
#ifdef HAVE_LUTIMES
- if (lutimes(a->name, times) != 0)
+ if ((lutimes(a->name, times) != 0) && (errno==ENOSYS) &&
+ (!S_ISLNK(a->mode) && utimes(a->name, times) != 0))
#else
if (!S_ISLNK(a->mode) && utimes(a->name, times) != 0)
#endif