fs: Filter out valid paths and volnames. (#1321)

This commit is contained in:
Harshavardhana
2016-04-16 19:33:29 -07:00
parent b2ec7da9f9
commit 33633fd15d
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -143,7 +143,7 @@ func removeDuplicateVols(vols []VolInfo) []VolInfo {
func getAllUniqueVols(dirPath string) ([]VolInfo, error) {
volumeFn := func(dirent fsDirent) bool {
// Return all directories.
return dirent.IsDir()
return dirent.IsDir() && isValidVolname(dirent.name)
}
namesOnly := false // Returned dirent names are absolute.
dirents, err := scandir(dirPath, volumeFn, namesOnly)