Implemented two missing functions.

geesefs-0-30-9
Aaron Jacobs 2015-03-03 10:40:04 +11:00
parent 6b81f4ce58
commit fa4c2fb864
1 changed files with 28 additions and 2 deletions

View File

@ -7,7 +7,9 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"os/user"
"path" "path"
"strconv"
"strings" "strings"
"syscall" "syscall"
"testing" "testing"
@ -27,9 +29,33 @@ func TestMemFS(t *testing.T) { RunTests(t) }
// Helpers // Helpers
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
func currentUid() uint32 func currentUid() uint32 {
user, err := user.Current()
if err != nil {
panic(err)
}
func currentGid() uint32 uid, err := strconv.ParseUint(user.Uid, 10, 32)
if err != nil {
panic(err)
}
return uint32(uid)
}
func currentGid() uint32 {
user, err := user.Current()
if err != nil {
panic(err)
}
gid, err := strconv.ParseUint(user.Gid, 10, 32)
if err != nil {
panic(err)
}
return uint32(gid)
}
func timespecToTime(ts syscall.Timespec) time.Time func timespecToTime(ts syscall.Timespec) time.Time