fix: optionally enable tracing posix calls

This commit is contained in:
Ritesh H Shukla
2021-03-23 14:51:27 -07:00
committed by Harshavardhana
parent 8adfeb0d84
commit 6a2ed44095
5 changed files with 230 additions and 59 deletions
+4 -4
View File
@@ -33,7 +33,7 @@ func readDir(dirPath string) (entries []string, err error) {
// the directory itself, if the dirPath doesn't exist this function doesn't return
// an error.
func readDirFn(dirPath string, filter func(name string, typ os.FileMode) error) error {
d, err := os.Open(dirPath)
d, err := Open(dirPath)
if err != nil {
if osErrToFileErr(err) == errFileNotFound {
return nil
@@ -58,7 +58,7 @@ func readDirFn(dirPath string, filter func(name string, typ os.FileMode) error)
}
for _, fi := range fis {
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
fi, err = os.Stat(pathJoin(dirPath, fi.Name()))
fi, err = Stat(pathJoin(dirPath, fi.Name()))
if err != nil {
// It got deleted in the meantime, not found
// or returns too many symlinks ignore this
@@ -86,7 +86,7 @@ func readDirFn(dirPath string, filter func(name string, typ os.FileMode) error)
// Return N entries at the directory dirPath. If count is -1, return all entries
func readDirN(dirPath string, count int) (entries []string, err error) {
d, err := os.Open(dirPath)
d, err := Open(dirPath)
if err != nil {
return nil, osErrToFileErr(err)
}
@@ -117,7 +117,7 @@ func readDirN(dirPath string, count int) (entries []string, err error) {
}
for _, fi := range fis {
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
fi, err = os.Stat(pathJoin(dirPath, fi.Name()))
fi, err = Stat(pathJoin(dirPath, fi.Name()))
if err != nil {
// It got deleted in the meantime, not found
// or returns too many symlinks ignore this