diff options
author | tb <> | 2022-11-23 08:01:05 +0000 |
---|---|---|
committer | tb <> | 2022-11-23 08:01:05 +0000 |
commit | 991cfc6cdb4c08e8a4f31a7a5b698efc412232a6 (patch) | |
tree | 84571a0c4b76f200a4d34f0fcb98efc05b5a66ed | |
parent | 11e94872e32d80fdc1f0c80d7e4558f7906ca3e5 (diff) | |
download | openbsd-991cfc6cdb4c08e8a4f31a7a5b698efc412232a6.tar.gz openbsd-991cfc6cdb4c08e8a4f31a7a5b698efc412232a6.tar.bz2 openbsd-991cfc6cdb4c08e8a4f31a7a5b698efc412232a6.zip |
Neuter getrlimit dance, it's not portable enough. Stupid Windows.
-rw-r--r-- | src/regress/lib/libcrypto/bn/general/bn_unit.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/regress/lib/libcrypto/bn/general/bn_unit.c b/src/regress/lib/libcrypto/bn/general/bn_unit.c index 06df91751a..f1a2c780f7 100644 --- a/src/regress/lib/libcrypto/bn/general/bn_unit.c +++ b/src/regress/lib/libcrypto/bn/general/bn_unit.c | |||
@@ -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 $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
@@ -16,8 +16,6 @@ | |||
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <sys/resource.h> | ||
20 | |||
21 | #include <err.h> | 19 | #include <err.h> |
22 | #include <limits.h> | 20 | #include <limits.h> |
23 | #include <stdlib.h> | 21 | #include <stdlib.h> |
@@ -44,25 +42,17 @@ test_bn_print_wrapper(char *a, size_t size, const char *descr, | |||
44 | static int | 42 | static int |
45 | test_bn_print_null_derefs(void) | 43 | test_bn_print_null_derefs(void) |
46 | { | 44 | { |
47 | struct rlimit rlimit; | ||
48 | size_t size = INT_MAX / 4 + 4; | 45 | size_t size = INT_MAX / 4 + 4; |
49 | size_t datalimit = (size + 500 * 1024) / 1024; | 46 | size_t datalimit = (size + 500 * 1024) / 1024; |
50 | char *a; | 47 | char *a; |
51 | int failed = 0; | 48 | int failed = 0; |
52 | 49 | ||
53 | if (getrlimit(RLIMIT_DATA, &rlimit) != 0) | 50 | if ((a = malloc(size)) == NULL) { |
54 | err(1, "getrlimit"); | 51 | warn("malloc(%zu) failed (make sure data limit is > %zu)", |
55 | 52 | size, datalimit); | |
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"); | ||
60 | return 0; | 53 | return 0; |
61 | } | 54 | } |
62 | 55 | ||
63 | if ((a = malloc(size)) == NULL) | ||
64 | err(1, "malloc(%zu) failed", size); | ||
65 | |||
66 | memset(a, '0', size - 1); | 56 | memset(a, '0', size - 1); |
67 | a[size - 1] = '\0'; | 57 | a[size - 1] = '\0'; |
68 | 58 | ||