aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/eopen.h
blob: 42e8c5ddf54ee83f7ecbed2943153203d8c51b88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* See LICENSE file for copyright and license details. */
#include <fcntl.h>

#define eopen(...)  enopen(1, __VA_ARGS__)
#define enopen(...) xenopen(__VA_ARGS__, 0)

static inline int
xenopen(int status, const char *path, int flags, int mode, ...)
{
	int fd = open(path, flags, mode);
	if (fd < 0)
		enprintf(status, "open %s:", path);
	return fd;
}