summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2025-08-02 06:16:35 +0000
committercvs2svn <admin@example.com>2025-08-02 06:16:35 +0000
commita397c95f8aea58533e72379d6e0de12683ecd0dc (patch)
tree45ccaccd0ce2ea01650f0a9f5e9268a656e17e51 /src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c
parenta79e90e7342954ae2287db505811ca3c1cd336d7 (diff)
downloadopenbsd-tb_20250802.tar.gz
openbsd-tb_20250802.tar.bz2
openbsd-tb_20250802.zip
This commit was manufactured by cvs2git to create tag 'tb_20250802'.tb_20250802
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}