summary refs log tree commit diff stats
path: root/unveil.go
blob: 99a9a82d0bd1061011f511d931ca9f9011e8cee4 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main

import (
	"fmt"
	"os"

	"tildegit.org/andinus/lynx"
)

// blockUnveil func blocks further unveil calls.
func blockUnveil() {
	err := lynx.UnveilBlock()
	if err != nil {
		fmt.Printf("%s :: %s",
			"UnveilBlock() failed",
			err.Error())
		os.Exit(1)
	}

	// We drop unveil from promises after blocking it. We drop
	// rpath too because the config file has been read.
	err = lynx.PledgePromises("stdio exec")
	if err != nil {
		fmt.Printf("%s :: %s",
			"blockUnveil failed",
			err.Error())
		os.Exit(1)
	}
}

// initUnveil initializes unveil for inital use.
func initUnveil() {
	err := lynx.Unveil(configFile, "rc")
	if err != nil {
		fmt.Printf("%s :: %s",
			"Unveil configFile failed",
			err.Error())
		os.Exit(1)
	}
}