Files
dbbackup/internal/restore/diskspace_bsd.go
Renz 0cf21cd893 feat: Complete MEDIUM priority security features with testing
- Implemented TUI auto-select for automated testing
- Fixed TUI automation: autoSelectMsg handling in Update()
- Auto-database selection in DatabaseSelector
- Created focused test suite (test_as_postgres.sh)
- Created retention policy test (test_retention.sh)
- All 10 security tests passing

Features validated:
 Backup retention policy (30 days, min backups)
 Rate limiting (exponential backoff)
 Privilege checks (root detection)
 Resource limit validation
 Path sanitization
 Checksum verification (SHA-256)
 Audit logging
 Secure permissions
 Configuration persistence
 TUI automation framework

Test results: 10/10 passed
Backup files created with .dump, .sha256, .info
Retention cleanup verified (old files removed)
2025-11-25 15:25:56 +00:00

16 lines
369 B
Go
Executable File

// +build openbsd
package restore
import "syscall"
// getDiskSpace returns available disk space in bytes (OpenBSD)
func getDiskSpace(path string) (int64, error) {
var statfs syscall.Statfs_t
if err := syscall.Statfs(path, &statfs); err != nil {
return 0, err
}
// OpenBSD uses F_bavail and F_bsize
return int64(statfs.F_bavail) * int64(statfs.F_bsize), nil
}