summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stagit-index.c3
-rw-r--r--stagit.c7
2 files changed, 10 insertions, 0 deletions
diff --git a/stagit-index.c b/stagit-index.c
index cc70e4d..9a1f902 100644
--- a/stagit-index.c
+++ b/stagit-index.c
@@ -159,6 +159,9 @@ main(int argc, char *argv[])
git_libgit2_init();
#ifdef __OpenBSD__
+ for (i = 1; i < argc; i++)
+ if (unveil(argv[i], "r") == -1)
+ err(1, "unveil: %s", argv[i]);
if (pledge("stdio rpath", NULL) == -1)
err(1, "pledge");
#endif
diff --git a/stagit.c b/stagit.c
index a6cfebc..dcac016 100644
--- a/stagit.c
+++ b/stagit.c
@@ -1095,6 +1095,13 @@ main(int argc, char *argv[])
git_libgit2_init();
#ifdef __OpenBSD__
+ if (unveil(repodir, "r") == -1)
+ err(1, "unveil: %s", repodir);
+ if (unveil(".", "rwc") == -1)
+ err(1, "unveil: .");
+ if (cachefile && unveil(cachefile, "rwc") == -1)
+ err(1, "unveil: %s", cachefile);
+
if (cachefile) {
if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
err(1, "pledge");