aboutsummaryrefslogtreecommitdiff
path: root/rlimit.go
diff options
context:
space:
mode:
authorlawl <github@dumbinter.net>2020-07-21 18:58:10 +0200
committerlawl <github@dumbinter.net>2020-07-21 18:58:10 +0200
commit9bcb2a0c8dc64ad73c707502b1991f13b71c4fef (patch)
tree5cb0bae577f3d00178728dafdb3f147862e4630f /rlimit.go
parent3fc46d2d30ca26eaece8d1dac15d556b0a6f1f7f (diff)
downloadnoisetorch-9bcb2a0c8dc64ad73c707502b1991f13b71c4fef.tar.gz
noisetorch-9bcb2a0c8dc64ad73c707502b1991f13b71c4fef.zip
Respect PULSE_RUNTME_PATH and PULSE_COOKIE
Diffstat (limited to 'rlimit.go')
-rw-r--r--rlimit.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/rlimit.go b/rlimit.go
index bb76c5e..4bef3d8 100644
--- a/rlimit.go
+++ b/rlimit.go
@@ -1,22 +1,25 @@
package main
import (
- "fmt"
"io/ioutil"
"log"
"os"
"os/exec"
- "path/filepath"
"strconv"
"strings"
"syscall"
"unsafe"
+
+ "github.com/lawl/pulseaudio"
)
const rlimitRTTime = 15
func getPulsePid() (int, error) {
- pulsepidfile := filepath.Join(xdgOrFallback("XDG_RUNTIME_DIR", fmt.Sprintf("/run/user/%d", os.Getuid())), "pulse/pid")
+ pulsepidfile, err := pulseaudio.RuntimePath("pid")
+ if err != nil {
+ return 0, err
+ }
pidbuf, err := ioutil.ReadFile(pulsepidfile)
if err != nil {
return 0, err