aboutsummaryrefslogtreecommitdiff
path: root/filesystem/path.go
diff options
context:
space:
mode:
authorebiggers <ebiggers@google.com>2020-01-23 13:41:42 -0800
committerJoseph Richey <joerichey@google.com>2020-01-23 13:41:42 -0800
commitf2eb79fb5fb10275c014b55c13e28ff02d3b70a8 (patch)
tree84c9595d1bd9e13564d79ba5de7d366ca34c0b48 /filesystem/path.go
parent303616dc52e2b1e71883417a291f07c59025215d (diff)
filesystem: remove canonicalizePath() (#185)
canonicalizePath() is now only used by an error path in getMountFromLink(), which we can make use getDeviceName() instead.
Diffstat (limited to 'filesystem/path.go')
-rw-r--r--filesystem/path.go17
1 files changed, 0 insertions, 17 deletions
diff --git a/filesystem/path.go b/filesystem/path.go
index 376daf0..b9b403d 100644
--- a/filesystem/path.go
+++ b/filesystem/path.go
@@ -23,7 +23,6 @@ import (
"fmt"
"log"
"os"
- "path/filepath"
"golang.org/x/sys/unix"
@@ -41,22 +40,6 @@ func OpenFileOverridingUmask(name string, flag int, perm os.FileMode) (*os.File,
// We only check the unix permissions and the sticky bit
const permMask = os.ModeSticky | os.ModePerm
-// canonicalizePath turns path into an absolute path without symlinks.
-func canonicalizePath(path string) (string, error) {
- path, err := filepath.Abs(path)
- if err != nil {
- return "", err
- }
- path, err = filepath.EvalSymlinks(path)
-
- // Get a better error if we have an invalid path
- if pathErr, ok := err.(*os.PathError); ok {
- err = errors.Wrap(pathErr.Err, pathErr.Path)
- }
-
- return path, err
-}
-
// loggedStat runs os.Stat, but it logs the error if stat returns any error
// other than nil or IsNotExist.
func loggedStat(name string) (os.FileInfo, error) {