X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fregression%2Fmalloc-brk-fail.c;h=d0ccd35f3a4023a974687c545e65a32c87540998;hb=HEAD;hp=13908d8ac276902cdff19bb797e3e6d1db1d4664;hpb=2b9639f0f09c5b8bcd245fac49b2fb9da23b0302;p=libc-test diff --git a/src/regression/malloc-brk-fail.c b/src/regression/malloc-brk-fail.c index 13908d8..420b000 100644 --- a/src/regression/malloc-brk-fail.c +++ b/src/regression/malloc-brk-fail.c @@ -1,7 +1,9 @@ +// commit 5446303328adf4b4e36d9fba21848e6feb55fab4 2014-04-02 // malloc should not fail if brk fails but mmap can still allocate #include #include #include +#include #include #include "test.h" @@ -19,8 +21,6 @@ int main(void) t_error("vmfill failed\n"); return 1; } - errno = 0; - T(t_setrlim(RLIMIT_DATA, 0)); // malloc should fail here errno = 0; @@ -30,8 +30,8 @@ int main(void) else if (errno != ENOMEM) t_error("malloc did not fail with ENOMEM, got %s\n", strerror(errno)); - // make some space available for mmap - T(munmap(p+65536, 65536)); + // make space available for mmap, but ensure it's not contiguous with brk + T(munmap((char*)p+65536, n-65536)); // malloc should succeed now q = malloc(10000);