summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
committercvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
commiteb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch)
treeedb6da6af7e865d488dc1a29309f1e1ec226e603 /src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c
parent247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff)
downloadopenbsd-tb_20250414.tar.gz
openbsd-tb_20250414.tar.bz2
openbsd-tb_20250414.zip
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to 'src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c')
-rw-r--r--src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c b/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c
deleted file mode 100644
index 1759291f38..0000000000
--- a/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/* $OpenBSD: malloc_errno.c,v 1.5 2019/06/11 22:16:13 bluhm Exp $ */
2/*
3 * Public domain. 2003, Otto Moerbeek
4 */
5#include <err.h>
6#include <errno.h>
7#include <stdio.h>
8#include <stdlib.h>
9
10/* On arm64 with 2G of memory this test hangs while junking. */
11char *malloc_options = "jj";
12
13static void
14testerrno(size_t sz)
15{
16 void *p;
17
18 errno = -1;
19 p = malloc(sz);
20
21 if (p == NULL && errno != ENOMEM)
22 errx(1, "fail: %lx %p %d", (unsigned long)sz, p, errno);
23
24 /* if alloc succeeded, test if errno did not change */
25 if (p != NULL && errno != -1)
26 errx(1, "fail: %lx %p %d", (unsigned long)sz, p, errno);
27
28 free(p);
29}
30
31/*
32 * Provide some (silly) arguments to malloc(), and check if ERRNO is set
33 * correctly.
34 */
35int
36main(int argc, char *argv[])
37{
38 size_t i;
39
40 testerrno(1);
41 testerrno(100000);
42 testerrno(-1);
43 testerrno(-1000);
44 testerrno(-10000);
45 testerrno(-10000000);
46 for (i = 0; i < 0x10; i++)
47 testerrno(i * 0x10000000);
48 return 0;
49}