mirror of
https://github.com/facebook/zstd.git
synced 2025-11-28 00:04:28 -05:00
fixed timespec_get() initialization bug on some targets
not sure why, but msan fires an "unitialized variable" error when time gets properly initialized by timespec_get(). Maybe in some cases, not all bytes of the structure are initialized ? Or maybe msan fails to detect the initialization ? Anyway, pre-initializing the variable before passing it to timespec_get() works.
This commit is contained in:
parent
058da605cb
commit
1e01560b83
@ -91,8 +91,10 @@ PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd)
|
|||||||
|
|
||||||
UTIL_time_t UTIL_getTime(void)
|
UTIL_time_t UTIL_getTime(void)
|
||||||
{
|
{
|
||||||
UTIL_time_t time;
|
/* time must be initialized, othersize it may fail msan test.
|
||||||
if (timespec_get(&time, TIME_UTC) == 0) {
|
* No good reason, likely a limitation of timespec_get() for some target */
|
||||||
|
UTIL_time_t time = UTIL_TIME_INITIALIZER;
|
||||||
|
if (timespec_get(&time, TIME_UTC) != TIME_UTC) {
|
||||||
perror("timefn::timespec_get");
|
perror("timefn::timespec_get");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user