about summary refs log tree commit diff
path: root/xpledge.h
blob: a6065a9600e6b89a1c4a6c4f136f0add2a931255 (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
25
26
#ifndef PLEDGE_H
#define PLEDGE_H

#ifdef __OpenBSD__

#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif

#include <err.h>
#include <unistd.h>

static void
xpledge(const char *promises, const char *execpromises)
{
	if (pledge(promises, execpromises) == -1)
		err(1, "pledge");
}

#else

#define xpledge(promises, execpromises) do { } while(0)

#endif /* __OpenBSD__ */

#endif /* PLEDGE_H */