1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 06:40:31 +00:00

Bump libcompose and sync dependencies

This commit is contained in:
Josh Curl
2016-05-31 22:01:53 -07:00
parent 742c9a9401
commit 7ea6dfbe07
829 changed files with 34 additions and 125457 deletions

View File

@@ -1,45 +0,0 @@
// +build static_build
package dbus
import (
"bufio"
"os"
"strconv"
"strings"
)
func lookupHomeDir() string {
myUid := os.Getuid()
f, err := os.Open("/etc/passwd")
if err != nil {
return "/"
}
defer f.Close()
s := bufio.NewScanner(f)
for s.Scan() {
if err := s.Err(); err != nil {
break
}
line := strings.TrimSpace(s.Text())
if line == "" {
continue
}
parts := strings.Split(line, ":")
if len(parts) >= 6 {
uid, err := strconv.Atoi(parts[2])
if err == nil && uid == myUid {
return parts[5]
}
}
}
// Default to / if we can't get a better value
return "/"
}