Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
user: *: fix function signatures
Browse files Browse the repository at this point in the history
This patch changes the incorrectly named functions GetPasswdFile,
GetGroupFile, GetExecUserFile and several internal components to
GetPasswdPath, GetGroupPath, etc -- as these are far more appropriate
names and more clearly convey to users what the arguments represent.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
  • Loading branch information
cyphar committed Dec 16, 2014
1 parent 42fed75 commit b322073
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions user/lookup_unix.go
Expand Up @@ -9,22 +9,22 @@ import (

// Unix-specific path to the passwd and group formatted files.
const (
unixPasswdFile = "/etc/passwd"
unixGroupFile = "/etc/group"
unixPasswdPath = "/etc/passwd"
unixGroupPath = "/etc/group"
)

func GetPasswdFile() (string, error) {
return unixPasswdFile, nil
func GetPasswdPath() (string, error) {
return unixPasswdPath, nil
}

func GetPasswd() (io.ReadCloser, error) {
return os.Open(unixPasswdFile)
return os.Open(unixPasswdPath)
}

func GetGroupFile() (string, error) {
return unixGroupFile, nil
func GetGroupPath() (string, error) {
return unixGroupPath, nil
}

func GetGroup() (io.ReadCloser, error) {
return os.Open(unixGroupFile)
return os.Open(unixGroupPath)
}
4 changes: 2 additions & 2 deletions user/lookup_unsupported.go
Expand Up @@ -4,15 +4,15 @@ package user

import "io"

func GetPasswdFile() (string, error) {
func GetPasswdPath() (string, error) {
return "", ErrUnsupported
}

func GetPasswd() (io.ReadCloser, error) {
return nil, ErrUnsupported
}

func GetGroupFile() (string, error) {
func GetGroupPath() (string, error) {
return "", ErrUnsupported
}

Expand Down
4 changes: 2 additions & 2 deletions user/user.go
Expand Up @@ -197,11 +197,11 @@ type ExecUser struct {
Home string
}

// GetExecUserFile is a wrapper for GetExecUser. It reads data from each of the
// GetExecUserPath is a wrapper for GetExecUser. It reads data from each of the
// given file paths and uses that data as the arguments to GetExecUser. If the
// files cannot be opened for any reason, the error is ignored and a nil
// io.Reader is passed instead.
func GetExecUserFile(userSpec string, defaults *ExecUser, passwdPath, groupPath string) (*ExecUser, error) {
func GetExecUserPath(userSpec string, defaults *ExecUser, passwdPath, groupPath string) (*ExecUser, error) {
passwd, err := os.Open(passwdPath)
if err != nil {
passwd = nil
Expand Down

0 comments on commit b322073

Please sign in to comment.