]> Zhao Yanbai Git Server - minix.git/commitdiff
tar: use utime() to restore timestamps
authorBen Gras <ben@minix3.org>
Mon, 14 Jan 2013 23:19:35 +0000 (23:19 +0000)
committerBen Gras <ben@minix3.org>
Tue, 15 Jan 2013 07:28:58 +0000 (07:28 +0000)
. otherwise all extracted files get 'now'

bin/pax/file_subs.c

index ea7a66a8bd238fbc7bb3dbd82bd11dd8ddd4bcda..e6ba65e4998b067f675c8f41b62ab02ae7210561 100644 (file)
@@ -62,6 +62,10 @@ __RCSID("$NetBSD: file_subs.c,v 1.62 2009/04/07 19:52:35 perry Exp $");
 #include "extern.h"
 #include "options.h"
 
+#ifdef __minix
+#include <utime.h>
+#endif
+
 char *xtmp_name;
 
 static int
@@ -842,8 +846,15 @@ set_ftime(char *fnm, time_t mtime, time_t atime, int frc, int slk)
 #endif
        if (slk)
                return;
-#ifndef __minix
-/* LSC: FIXME UGLY Hack */
+#ifdef __minix
+       {
+               struct utimbuf timp;
+               timp.actime = atime;
+               timp.modtime = mtime;
+               if (utime(fnm, &timp) < 0)
+                       goto bad;
+       }
+#else
        if (utimes(fnm, tv) == -1)
                goto bad;
 #endif