JD for Linux

2011/08/15 tv[0].tv_usecの代入式の恥ずかしい間違いを修正。


2.8.1-110312までは普通に./autogen.sh && ./configure && gmakeで問題なかったが、2.8.2-110808はちょっと修正が必要だったのでメモ。

patch-jd-2.8.2-110808

--- src/cache.cpp.orig	2011-07-27 21:29:16.000000000 +0900
+++ src/cache.cpp	2011-08-09 23:10:53.000000000 +0900
@@ -28,6 +28,10 @@
 #include <fcntl.h>
 #include <cstring>
 
+#ifdef __FreeBSD__
+#include <sys/time.h>
+#endif	// __FreeBSD__
+
 enum
 {
     MAX_SAFE_PATH = 1024
@@ -816,6 +820,16 @@
     if( stat( to_locale_cstr( path ), &buf_stat ) != 0 ) return false;
     if( S_ISREG( buf_stat.st_mode ) ){
 
+#ifdef __FreeBSD__
+        struct timeval tv[2];
+
+        tv[0].tv_sec  = buf_stat.st_atime;
+        tv[0].tv_usec = buf_stat.st_atimespec.tv_nsec / 1000;
+        tv[1].tv_sec  = mtime;
+        tv[1].tv_usec = 0;
+
+        if( ! lutimes(to_locale_cstr( path ), tv ) ) return true;
+#else	// __FreeBSD__
         struct timespec ts[2];         
 
         ts[0].tv_sec  = buf_stat.st_atime;
@@ -824,6 +838,7 @@
         ts[1].tv_nsec = 0;
 
         if( ! utimensat( AT_FDCWD, to_locale_cstr( path ), ts, AT_SYMLINK_NOFOLLOW ) ) return true;
+#endif	// __FreeBSD__
     }
 
     return false;