From: Jeremy Allison Date: Fri, 29 Aug 2008 16:29:07 +0000 (-0700) Subject: Deal with systems that don't initialize birthtime correctly. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4f60348c0a934123a8e15bc741076366f6713390;p=thirdparty%2Fsamba.git Deal with systems that don't initialize birthtime correctly. Pointed out by SATOH Fumiyasu . Jeremy. --- diff --git a/source/lib/time.c b/source/lib/time.c index 3cf0cb4f640..8cefef6e233 100644 --- a/source/lib/time.c +++ b/source/lib/time.c @@ -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 . + */ + if (null_timespec(ret)) { + ret.tv_sec = calc_create_time(pst); + ret.tv_nsec = 0; + } + return ret; } /****************************************************************************