summaryrefslogtreecommitdiff
path: root/stagit.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-05-03 00:33:56 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-05-03 00:33:56 +0200
commitaa36e0c9b4d8da06c5dc03a461f9d3fe69a1e7fb (patch)
tree5f0c8af726df1cbd425e4d33c77aa9410328196a /stagit.c
parenteae9437f944f04619cbda9ce7eb460f6ff0d7f4c (diff)
add OpenBSD pledge(2) support using -DUSE_PLEDGE
Diffstat (limited to 'stagit.c')
-rw-r--r--stagit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/stagit.c b/stagit.c
index 1e4d1bb..9a8c32f 100644
--- a/stagit.c
+++ b/stagit.c
@@ -64,6 +64,14 @@ static char lastoidstr[GIT_OID_HEXSZ + 2]; /* id + newline + nul byte */
static FILE *rcachefp, *wcachefp;
static const char *cachefile;
+#ifndef USE_PLEDGE
+int
+pledge(const char *promises, const char *paths[])
+{
+ return 0;
+}
+#endif
+
void
deltainfo_free(struct deltainfo *di)
{
@@ -1033,6 +1041,9 @@ main(int argc, char *argv[])
size_t n;
int i, fd;
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "pledge");
+
for (i = 1; i < argc; i++) {
if (argv[i][0] != '-') {
if (repodir)