summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-04-25 17:26:25 +0530
committerAndinus <andinus@nand.sh>2020-04-25 17:26:25 +0530
commit348f101837f9f435ff52fefd58d7ea14b756c87c (patch)
treef7af427af09732851eb7a6c53afa3bc2d6b0da2d
parent5fb5e4f21f6408d7ff13e4ccb9ca5c636ef615a8 (diff)
downloadpavo-348f101837f9f435ff52fefd58d7ea14b756c87c.tar.gz
Add pledge functions
-rw-r--r--pledge.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/pledge.go b/pledge.go
new file mode 100644
index 0000000..8e6e450
--- /dev/null
+++ b/pledge.go
@@ -0,0 +1,26 @@
+package main
+
+import (
+	"fmt"
+	"os"
+
+	"tildegit.org/andinus/lynx"
+)
+
+// initPledge initializes pledge for initial use.
+func initPledge() {
+	// Pledge promises can only be dropped & we cannot add
+	// anything so this call adds everything that maybe used in
+	// program later. We don't define execpromises here because
+	// that comes from the user.
+	//
+	// Note: Don't forget to change blockUnveil() if you add
+	// anything new here.
+	err := lynx.PledgePromises("unveil stdio rpath exec")
+	if err != nil {
+		fmt.Printf("%s :: %s",
+			"initPledge failed",
+			err.Error())
+		os.Exit(1)
+	}
+}