Explicitly call abort() if gettimeofday() doesn't succeed.
This commit is contained in:
parent
c82925f2e6
commit
194ad15904
@ -14,6 +14,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
@ -86,9 +87,10 @@ sodium_hrtime(void)
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
int ret = gettimeofday(&tv, NULL);
|
|
||||||
(void)ret;
|
if (gettimeofday(&tv, NULL) != 0) {
|
||||||
assert(ret == 0);
|
abort();
|
||||||
|
}
|
||||||
ts = ((uint64_t) tv.tv_sec) * 1000000U + (uint64_t) tv.tv_usec;
|
ts = ((uint64_t) tv.tv_sec) * 1000000U + (uint64_t) tv.tv_usec;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user