diff options
Diffstat (limited to 'src/regress/lib/libc/malloc/malloc_errno')
-rw-r--r-- | src/regress/lib/libc/malloc/malloc_errno/Makefile | 5 | ||||
-rw-r--r-- | src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c | 46 |
2 files changed, 0 insertions, 51 deletions
diff --git a/src/regress/lib/libc/malloc/malloc_errno/Makefile b/src/regress/lib/libc/malloc/malloc_errno/Makefile deleted file mode 100644 index 73ebe37491..0000000000 --- a/src/regress/lib/libc/malloc/malloc_errno/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | # $OpenBSD: Makefile,v 1.1 2003/07/15 10:06:31 otto Exp $ | ||
2 | |||
3 | PROG= malloc_errno | ||
4 | |||
5 | .include <bsd.regress.mk> | ||
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 896ea3c900..0000000000 --- a/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* $OpenBSD: malloc_errno.c,v 1.4 2003/12/25 18:49:57 miod 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 | static void | ||
11 | testerrno(size_t sz) | ||
12 | { | ||
13 | void *p; | ||
14 | |||
15 | errno = -1; | ||
16 | p = malloc(sz); | ||
17 | |||
18 | if (p == NULL && errno != ENOMEM) | ||
19 | errx(1, "fail: %lx %p %d", (unsigned long)sz, p, errno); | ||
20 | |||
21 | /* if alloc succeeded, test if errno did not change */ | ||
22 | if (p != NULL && errno != -1) | ||
23 | errx(1, "fail: %lx %p %d", (unsigned long)sz, p, errno); | ||
24 | |||
25 | free(p); | ||
26 | } | ||
27 | |||
28 | /* | ||
29 | * Provide some (silly) arguments to malloc(), and check if ERRNO is set | ||
30 | * correctly. | ||
31 | */ | ||
32 | int | ||
33 | main(int argc, char *argv[]) | ||
34 | { | ||
35 | size_t i; | ||
36 | |||
37 | testerrno(1); | ||
38 | testerrno(100000); | ||
39 | testerrno(-1); | ||
40 | testerrno(-1000); | ||
41 | testerrno(-10000); | ||
42 | testerrno(-10000000); | ||
43 | for (i = 0; i < 0x10; i++) | ||
44 | testerrno(i * 0x10000000); | ||
45 | return 0; | ||
46 | } | ||