Confine local file installation paths
This commit is contained in:
@@ -5,6 +5,7 @@ package fileops
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
@@ -39,3 +40,13 @@ func syncDirectory(path string) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func syncDirectoryFile(directory *os.File, path string) error {
|
||||
err := directory.Sync()
|
||||
if errors.Is(err, windows.ERROR_INVALID_FUNCTION) ||
|
||||
errors.Is(err, windows.ERROR_INVALID_HANDLE) ||
|
||||
errors.Is(err, windows.ERROR_NOT_SUPPORTED) {
|
||||
return fmt.Errorf("%w for %q: %w", ErrDirectorySyncUnsupported, path, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user