diff options
Diffstat (limited to 'src/utils/os_unix.c')
-rw-r--r-- | src/utils/os_unix.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c index 65c6fa412f207..1894fcdb0cf25 100644 --- a/src/utils/os_unix.c +++ b/src/utils/os_unix.c @@ -80,6 +80,9 @@ int os_get_reltime(struct os_reltime *t) struct timespec ts; int res; + if (TEST_FAIL()) + return -1; + while (1) { res = clock_gettime(clock_id, &ts); if (res == 0) { @@ -505,6 +508,16 @@ int os_memcmp_const(const void *a, const void *b, size_t len) } +void * os_memdup(const void *src, size_t len) +{ + void *r = os_malloc(len); + + if (r) + os_memcpy(r, src, len); + return r; +} + + #ifdef WPA_TRACE #if defined(WPA_TRACE_BFD) && defined(CONFIG_TESTING_OPTIONS) @@ -537,6 +550,8 @@ static int testing_fail_alloc(void) i++; if (i < res && os_strcmp(func[i], "os_strdup") == 0) i++; + if (i < res && os_strcmp(func[i], "os_memdup") == 0) + i++; pos = wpa_trace_fail_func; |