summaryrefslogtreecommitdiffstats
path: root/src/lib/test-fd-util.c
blob: 1058ecab4e7e6e308925a961d3aaaa3d8ad7e110 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Copyright (c) 2019 Dovecot authors, see the included COPYING file */

#include "test-lib.h"
#include "fd-util.h"

enum fatal_test_state fatal_i_close(unsigned int stage)
{
	if (stage == 0) {
		test_begin("fatal i_close");
	} else {
		test_end();
		return FATAL_TEST_FINISHED;
	}

	int fd = 0;
	const char *fatal_string = t_strdup_printf(
		"%s: close((&fd)) @ %s:%d attempted with fd=%d",
		__func__, __FILE__, __LINE__ + 2, fd);
	test_expect_fatal_string(fatal_string);
	i_close_fd(&fd);

	/* This cannot be reached. */
	return FATAL_TEST_ABORT;
}