Suppress errors for symbolic links witch point to a file.

This commit is contained in:
René Jochum 2015-02-17 22:21:37 +01:00 committed by spf13
parent aeddaee901
commit d2e022f2a7
3 changed files with 42 additions and 5 deletions

View file

@ -300,7 +300,19 @@ func getDirList() []string {
}
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
jww.ERROR.Printf("Symbolic links not supported, skipping '%s'", path)
link, err := filepath.EvalSymlinks(path)
if err != nil {
jww.ERROR.Printf("Cannot read symbolic link '%s', error was: %s", path, err)
return nil
}
linkfi, err := os.Stat(link)
if err != nil {
jww.ERROR.Printf("Cannot stat '%s', error was: %s", link, err)
return nil
}
if !linkfi.Mode().IsRegular() {
jww.ERROR.Printf("Symbolic links for directories not supported, skipping '%s'", path)
}
return nil
}