Skip to content

Commit 014e632

Browse files
author
tb
committed
Neuter getrlimit dance, it's not portable enough. Stupid Windows.
1 parent 9827b8a commit 014e632

File tree

1 file changed

+4
-14
lines changed
  • src/regress/lib/libcrypto/bn/general

1 file changed

+4
-14
lines changed

src/regress/lib/libcrypto/bn/general/bn_unit.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: bn_unit.c,v 1.2 2022/11/22 09:09:43 tb Exp $ */
1+
/* $OpenBSD: bn_unit.c,v 1.3 2022/11/23 08:01:05 tb Exp $ */
22

33
/*
44
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
@@ -16,8 +16,6 @@
1616
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1717
*/
1818

19-
#include <sys/resource.h>
20-
2119
#include <err.h>
2220
#include <limits.h>
2321
#include <stdlib.h>
@@ -44,25 +42,17 @@ test_bn_print_wrapper(char *a, size_t size, const char *descr,
4442
static int
4543
test_bn_print_null_derefs(void)
4644
{
47-
struct rlimit rlimit;
4845
size_t size = INT_MAX / 4 + 4;
4946
size_t datalimit = (size + 500 * 1024) / 1024;
5047
char *a;
5148
int failed = 0;
5249

53-
if (getrlimit(RLIMIT_DATA, &rlimit) != 0)
54-
err(1, "getrlimit");
55-
56-
if ((rlimit.rlim_cur + 1023) / 1024 < datalimit) {
57-
printf("%s: insufficient data limit. Need more than %zu KiB\n",
58-
__func__, datalimit);
59-
printf("SKIPPED\n");
50+
if ((a = malloc(size)) == NULL) {
51+
warn("malloc(%zu) failed (make sure data limit is > %zu)",
52+
size, datalimit);
6053
return 0;
6154
}
6255

63-
if ((a = malloc(size)) == NULL)
64-
err(1, "malloc(%zu) failed", size);
65-
6656
memset(a, '0', size - 1);
6757
a[size - 1] = '\0';
6858

0 commit comments

Comments
 (0)