Skip to content

Commit

Permalink
adding a better comment to CheckHomeDir and fixing style nits
Browse files Browse the repository at this point in the history
  • Loading branch information
eriktate committed Oct 22, 2024
1 parent aecd849 commit e8ebba8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/srv/reexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,8 @@ func RunNetworking() (errw io.Writer, code int, err error) {

// Create a minimal default environment for the user.
workingDir := string(os.PathSeparator)
hasAccess, err := CheckHomeDir(localUser)

hasAccess, err := CheckHomeDir(localUser)
if hasAccess && err == nil {
workingDir = localUser.HomeDir
}
Expand Down Expand Up @@ -1255,7 +1255,9 @@ func hasAccessibleHomeDir() error {
return nil
}

// CheckHomeDir checks if the user's home directory exists and is accessible to the user.
// CheckHomeDir checks if the user's home directory exists and is accessible to the user. Only catastrophic
// errors will be returned, which means a missing, inaccessible, or otherwise invalid home directory will result
// in a return of (false, nil)
func CheckHomeDir(localUser *user.User) (bool, error) {
currentUser, err := user.Current()
if err != nil {
Expand Down

0 comments on commit e8ebba8

Please sign in to comment.