mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 00:30:20 +00:00
Corrected cross-platform stat nanosecond code
When nanosecond time resolution was added for identifying config file changes, it didn't cover all of the myriad of ways that one might obtain nanosecond time resolution off of struct stat. Rather than complicate the #if even further figuring out one system from the next, this patch directly tests for the three struct members I know about today, and #ifdef's accordingly. Review: https://reviewboard.asterisk.org/r/3273/ ........ Merged revisions 409833 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 409834 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 409835 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409836 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1246,10 +1246,14 @@ static void cfmstat_clear(struct cache_file_mtime *cfmtime)
|
||||
static void cfmstat_save(struct cache_file_mtime *cfmtime, struct stat *statbuf)
|
||||
{
|
||||
cfmtime->stat_size = statbuf->st_size;
|
||||
#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || (defined(_POSIX_C_SOURCE) && 200809L <= _POSIX_C_SOURCE) || (defined(_XOPEN_SOURCE) && 700 <= _XOPEN_SOURCE)
|
||||
#if defined(HAVE_STRUCT_STAT_ST_MTIM)
|
||||
cfmtime->stat_mtime_nsec = statbuf->st_mtim.tv_nsec;
|
||||
#else
|
||||
#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC)
|
||||
cfmtime->stat_mtime_nsec = statbuf->st_mtimensec;
|
||||
#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC)
|
||||
cfmtime->stat_mtime_nsec = statbuf->st_mtimespec.tv_nsec;
|
||||
#else
|
||||
cfmtime->stat_mtime_nsec = 0;
|
||||
#endif
|
||||
cfmtime->stat_mtime = statbuf->st_mtime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user