blob: 8d3538403ba3fc9d8389a5272bc7a1eafbada52d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
--- a/exec.c 2018-07-10 13:36:22.698784874 +0000
+++ b/exec.c 2018-07-10 13:37:32.296154568 +0000
@@ -92,11 +92,16 @@
// Assume arguments are counted with the granularity of a single page,
// and allow two pages of headroom to account for rounding as well as
// any other data we may not be counting
+ // so allow a one page cushion to account for rounding up
long page_size = sysconf(_SC_PAGESIZE);
if (page_size < 4096) {
page_size = 4096;
}
- arg_max -= 2*page_size;
+ arg_max -= page_size;
+ bfs_exec_debug(execbuf, "ARG_MAX: %ld remaining after page cushion\n", arg_max);
+
+ // POSIX recommends an additional 2048 bytes of headroom
+ arg_max -= 2048;
bfs_exec_debug(execbuf, "ARG_MAX: %ld remaining after headroom\n", arg_max);
if (arg_max < 0) {
|