diff options
author | Jeremy Allison <jra@samba.org> | 2008-08-29 09:29:07 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-08-29 09:29:07 -0700 |
commit | b12c7dbb53023d1ea9e7df20137c0ad6ba21b9f0 (patch) | |
tree | 0ae35981fd84207d623b971c3883f89cd369246d /source3 | |
parent | d4818c70eb1275e532df0e6882bb761335d2dba2 (diff) | |
download | samba-b12c7dbb53023d1ea9e7df20137c0ad6ba21b9f0.tar.gz samba-b12c7dbb53023d1ea9e7df20137c0ad6ba21b9f0.tar.bz2 samba-b12c7dbb53023d1ea9e7df20137c0ad6ba21b9f0.zip |
Deal with systems that don't initialize birthtime correctly.
Pointed out by SATOH Fumiyasu <fumiyas@osstech.jp>.
Jeremy.
(This used to be commit 4f60348c0a934123a8e15bc741076366f6713390)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/time.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/lib/time.c b/source3/lib/time.c index 3cf0cb4f64..8cefef6e23 100644 --- a/source3/lib/time.c +++ b/source3/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 <fumiyas@osstech.jp>. + */ + if (null_timespec(ret)) { + ret.tv_sec = calc_create_time(pst); + ret.tv_nsec = 0; + } + return ret; } /**************************************************************************** |