diff options
author | George Kadianakis <desnacked@riseup.net> | 2019-09-16 15:19:38 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-09-16 15:19:38 +0300 |
commit | bdd17da9fdfbe9de0547f27c7a78255a56570aa4 (patch) | |
tree | 3ca05c5b84428e0020b7bbe451a0425a5a62c62d /src/lib/malloc | |
parent | 286b129b09964bbff2bd8f5de7f4edac5f2b4827 (diff) | |
parent | 0891a31ad32d0567fbc8f73a0598925cb543d699 (diff) | |
download | tor-bdd17da9fdfbe9de0547f27c7a78255a56570aa4.tar.gz tor-bdd17da9fdfbe9de0547f27c7a78255a56570aa4.zip |
Merge branch 'tor-github/pr/1318'
Diffstat (limited to 'src/lib/malloc')
-rw-r--r-- | src/lib/malloc/map_anon.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/malloc/map_anon.c b/src/lib/malloc/map_anon.c index 79bbb99f72..ae4edff769 100644 --- a/src/lib/malloc/map_anon.c +++ b/src/lib/malloc/map_anon.c @@ -149,18 +149,33 @@ noinherit_mem(void *mem, size_t sz, inherit_res_t *inherit_result_out) return 0; } #endif /* defined(FLAG_ZERO) */ + #ifdef FLAG_NOINHERIT int r2 = MINHERIT(mem, sz, FLAG_NOINHERIT); if (r2 == 0) { *inherit_result_out = INHERIT_RES_DROP; + return 0; + } +#endif /* defined(FLAG_NOINHERIT) */ + +#if defined(FLAG_ZERO) || defined(FLAG_NOINHERIT) + /* At least one operation was tried, and neither succeeded. */ + + if (errno == ENOSYS || errno == EINVAL) { + /* Syscall not supported, or flag not supported. */ + return 0; + } else { + tor_log_err_sigsafe("Unexpected error from minherit: ", + strerror(errno), + NULL); + return -1; } - return r2; -#else /* !(defined(FLAG_NOINHERIT)) */ +#else (void)inherit_result_out; (void)mem; (void)sz; return 0; -#endif /* defined(FLAG_NOINHERIT) */ +#endif } /** |