xref: /freebsd/lib/csu/tests/errno/errno_test.c (revision 328110da2661a8841f12000b99fea27ceacdd5b2)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2025 Mark Johnston <markj@FreeBSD.org>
5  */
6 
7 #include <errno.h>
8 #include <stdlib.h>
9 
10 static void __attribute__((constructor))
11 f(void)
12 {
13 	errno = 42;
14 }
15 
16 int
17 main(void)
18 {
19 	/* errno must be zero upon program startup. */
20 	if (errno != 0)
21 		exit(1);
22 	exit(0);
23 }
24