Browse Source

handle nil usr

Jonathan Turner 8 years ago
parent
commit
e1c433026a
1 changed files with 3 additions and 5 deletions
  1. 3 5
      config/krb5conf.go

+ 3 - 5
config/krb5conf.go

@@ -84,12 +84,10 @@ type LibDefaults struct {
 
 // Create a new LibDefaults struct.
 func newLibDefaults() *LibDefaults {
-	var uid string
+	uid := "0"
 	var hdir string
-	usr, err := user.Current()
-	if err != nil || usr == nil {
-		uid = "0"
-	} else {
+	usr, _ := user.Current()
+	if usr != nil {
 		uid = usr.Uid
 		hdir = usr.HomeDir
 	}