Merge branch '2166-bind-9-16-7-trap-divide-error' into 'main'

Resolve "bind 9.16.7 trap divide error"

Closes #2166

See merge request isc-projects/bind9!4141
This commit is contained in:
Ondřej Surý 2020-09-21 08:57:12 +00:00
commit 317af42ae3
3 changed files with 15 additions and 1 deletions

View file

@ -1,3 +1,6 @@
5506. [bug] Properly handle failed sysconf() calls, so we don't
report invalid memory size. [GL #2166]
5505. [bug] Updating contents of a mixed-case RPZ could cause some
rules to be ignored. [GL #2169]

View file

@ -42,3 +42,7 @@ Bug Fixes
- Updating contents of an RPZ zone which contained names spelled using
varying letter case could cause some processing rules in that RPZ zone
to be erroneously ignored. [GL #2169]
- `named` would report invalid memory size when running in an environment
that doesn't properly report number of available memory pages or pagesize.
[GL #2166]

View file

@ -35,7 +35,14 @@ isc_meminfo_totalphys(void) {
#endif /* if defined(CTL_HW) && (defined(HW_PHYSMEM64) || defined(HW_MEMSIZE)) \
* */
#if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
return ((size_t)(sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE)));
long pages = sysconf(_SC_PHYS_PAGES);
long pagesize = sysconf(_SC_PAGESIZE);
if (pages == -1 || pagesize == -1) {
return (0);
}
return ((size_t)pages * pagesize);
#endif /* if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) */
return (0);
}