unveil: init
This commit is contained in:
parent
60298a6953
commit
5ea7cae973
3 changed files with 37 additions and 0 deletions
4
main.go
4
main.go
|
@ -20,6 +20,10 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for path := range []string{c.Dirs.Static, c.Repo.ScanPath, c.Dirs.Templates} {
|
||||||
|
// Unveil(path, "r")
|
||||||
|
// }
|
||||||
|
|
||||||
mux := routes.Handlers(c)
|
mux := routes.Handlers(c)
|
||||||
addr := fmt.Sprintf("%s:%d", c.Server.Host, c.Server.Port)
|
addr := fmt.Sprintf("%s:%d", c.Server.Host, c.Server.Port)
|
||||||
log.Println("starting server on", addr)
|
log.Println("starting server on", addr)
|
||||||
|
|
|
@ -210,6 +210,11 @@ a:hover {
|
||||||
|
|
||||||
.line-numbers {
|
.line-numbers {
|
||||||
white-space: pre-line;
|
white-space: pre-line;
|
||||||
|
-moz-user-select: -moz-none;
|
||||||
|
-khtml-user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-o-user-select: none;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-wrapper {
|
.file-wrapper {
|
||||||
|
|
28
unveil.go
Normal file
28
unveil.go
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
//go:build openbsd
|
||||||
|
// +build openbsd
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Unveil(path string, perms string) error {
|
||||||
|
cpath := C.CString(path)
|
||||||
|
defer C.free(unsafe.Pointer(cpath))
|
||||||
|
cperms := C.CString(perms)
|
||||||
|
defer C.free(unsafe.Pointer(cperms))
|
||||||
|
|
||||||
|
rv, err := C.unveil(cpath, cperms)
|
||||||
|
if rv != 0 {
|
||||||
|
return fmt.Errorf("unveil(%s, %s) failure (%d)", path, perms, err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Reference in a new issue