Add wrappers to reduce #ifdefs.

Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
This commit is contained in:
Edward Tomasz Napierala 2017-07-29 12:28:49 +01:00
commit 12e2c46d6a
5 changed files with 37 additions and 55 deletions

View file

@ -161,6 +161,14 @@ int capsicum_open(const char *path, int flags, int mode)
return (fd);
}
int capsicum_open_wrapper(const char *path, int flags, int mode)
{
if (capsicum_enabled()) {
return capsicum_open(path, flags, mode);
}
return open(path, flags, mode);
}
void capsicum_mkdir_with_parents(const char *path, int mode)
{
char *component, *copy, *tofree;
@ -201,6 +209,15 @@ void capsicum_mkdir_with_parents(const char *path, int mode)
close(fd);
}
void capsicum_mkdir_with_parents_wrapper(const char *path, int mode)
{
if (capsicum_enabled()) {
capsicum_mkdir_with_parents(path, mode);
return;
}
g_mkdir_with_parents(path, mode);
}
nvlist_t *symbiont_connect(const nvlist_t *request)
{
nvlist_t *response;