mount: fix crash in mountpoint validation (#21879)

This commit is contained in:
Michael Eischer authored and Michael Eischer committed 2026-06-23 19:09:57 +02:00
1 parent 4134bdfac2
commit d6fd4ae26f
2 files changed
+9

No files matched your search

+2
View File
@@ -226,6 +226,8 @@ func validateMountpoint(mountpoint string, gopts global.Options) error {
stat, err := os.Stat(mountpoint)
if errors.Is(err, os.ErrNotExist) {
return errors.Fatal(fmt.Sprintf("mountpoint %s does not exist", mountpoint))
} else if err != nil {
return errors.Fatal(fmt.Sprintf("mountpoint %s is inaccessible: %v", mountpoint, err))
} else if !stat.IsDir() {
return errors.Fatal(fmt.Sprintf("mountpoint %s is not a directory", mountpoint))
}