mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Merge branch 'tor-github/pr/1285'
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
/**
|
||||
* Macro to get the high bytes of a size_t, if there are high bytes.
|
||||
* Windows needs this; other operating systems define a size_t that does
|
||||
@@ -108,7 +111,17 @@ static int
|
||||
nodump_mem(void *mem, size_t sz)
|
||||
{
|
||||
#if defined(MADV_DONTDUMP)
|
||||
return madvise(mem, sz, MADV_DONTDUMP);
|
||||
int rv = madvise(mem, sz, MADV_DONTDUMP);
|
||||
if (rv == 0) {
|
||||
return 0;
|
||||
} else if (errno == ENOSYS || errno == EINVAL) {
|
||||
return 0; // syscall not supported, or flag not supported.
|
||||
} else {
|
||||
tor_log_err_sigsafe("Unexpected error from madvise: ",
|
||||
strerror(errno),
|
||||
NULL);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
(void) mem;
|
||||
(void) sz;
|
||||
|
||||
Reference in New Issue
Block a user