xref: /src/lib/csu/tests/errno/errno_test.c (revision b5c04c8f96f6b51edb767e37aba0ea13b172723a)
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))
f(void)11 f(void)
12 {
13 	errno = 42;
14 }
15 
16 int
main(void)17 main(void)
18 {
19 	/* errno must be zero upon program startup. */
20 	if (errno != 0)
21 		exit(1);
22 	exit(0);
23 }
24