Merge branch 'v3-devel' of ssh://jra@git.samba.org/data/git/samba into v3-devel
authorJeremy Allison <jra@samba.org>
Fri, 29 Aug 2008 16:29:21 +0000 (09:29 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 29 Aug 2008 16:29:21 +0000 (09:29 -0700)
(This used to be commit 882297edc024c146f24fc9f847d2b0b813f93fc7)

source3/lib/time.c

index 3cf0cb4f640104901ce6604ac66a204f69e794ae..8cefef6e2331357fbe827d6fc3bf2f155a6b8f00 100644 (file)
@@ -860,20 +860,26 @@ struct timespec get_create_timespec(const SMB_STRUCT_STAT *pst,bool fake_dirs)
        }
 
 #if defined(HAVE_STAT_ST_BIRTHTIMESPEC)
-       return pst->st_birthtimespec;
+       ret = pst->st_birthtimespec;
 #elif defined(HAVE_STAT_ST_BIRTHTIMENSEC)
        ret.tv_sec = pst->st_birthtime;
        ret.tv_nsec = pst->st_birthtimenspec;
-       return ret;
 #elif defined(HAVE_STAT_ST_BIRTHTIME)
        ret.tv_sec = pst->st_birthtime;
        ret.tv_nsec = 0;
-       return ret;
 #else
        ret.tv_sec = calc_create_time(pst);
        ret.tv_nsec = 0;
-       return ret;
 #endif
+
+       /* Deal with systems that don't initialize birthtime correctly.
+        * Pointed out by SATOH Fumiyasu <fumiyas@osstech.jp>.
+        */
+       if (null_timespec(ret)) {
+               ret.tv_sec = calc_create_time(pst);
+               ret.tv_nsec = 0;
+       }
+       return ret;
 }
 
 /****************************************************************************