summaryrefslogtreecommitdiffstats
path: root/lib/at.c
blob: e32a8f5d35a49573b802a6b8f639004b723ff386 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * Portable xxxat() functions.
 *
 * No copyright is claimed.  This code is in the public domain; do with
 * it what you wish.
 *
 * Written by Karel Zak <kzak@redhat.com>
 */
#include <stdio.h>
#include <fcntl.h>

#include "at.h"
#include "c.h"

FILE *fopen_at(int dir, const char *filename, int flags,
			const char *mode)
{
	int fd = openat(dir, filename, flags);

	if (fd < 0)
		return NULL;

	return fdopen(fd, mode);
}