mirror of
https://github.com/gopasspw/gopass.git
synced 2026-05-30 11:18:48 +02:00
71861e4a8b
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
36 lines
656 B
Go
36 lines
656 B
Go
//go:build linux
|
|
|
|
package tempfile
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
var shmDir = "/dev/shm"
|
|
|
|
// tempdir returns a temporary directory suiteable for sensitive data. It tries
|
|
// /dev/shm but if this isn't working it will return an empty string. Using
|
|
// this with ioutil.Tempdir will ensure that we're getting the "best" tempdir.
|
|
func tempdirBase() string {
|
|
if fi, err := os.Stat(shmDir); err == nil {
|
|
if fi.IsDir() {
|
|
if unix.Access(shmDir, unix.W_OK) == nil {
|
|
return shmDir
|
|
}
|
|
}
|
|
}
|
|
|
|
return ""
|
|
}
|
|
|
|
func (t *File) mount(context.Context) error {
|
|
return nil
|
|
}
|
|
|
|
func (t *File) unmount(context.Context) error {
|
|
return nil
|
|
}
|