TODO: get homedir of euid?

This commit is contained in:
brent s. 2021-02-19 03:20:50 -05:00
parent 6d0cd91683
commit bb786855fc
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
1 changed files with 8 additions and 0 deletions

View File

@ -24,7 +24,9 @@ import (
"os"
"os/user"
"path/filepath"
// "strconv"
"strings"
// "syscall"
)

var err error
@ -37,6 +39,12 @@ func ExpandHome(path *string) error {
} else if (*path)[0] != '~' {
return nil
}
// E(ffective)UID (e.g. chown'd user for SUID)
/*
uid := strconv.Itoa(syscall.Geteuid())
usr, err := user.LookupId(euid)
*/
// R(real)UID (invoking user)
usr, err := user.Current()
if err != nil {
return err