first commit
This commit is contained in:
14
httpdl/alloc_other.go
Normal file
14
httpdl/alloc_other.go
Normal file
@@ -0,0 +1,14 @@
|
||||
//go:build !linux
|
||||
|
||||
package httpdl
|
||||
|
||||
import "os"
|
||||
|
||||
// allocate is the portable fallback: fallocate is Linux-specific, so on other
|
||||
// platforms prealloc/falloc degrade to a plain truncate.
|
||||
func allocate(f *os.File, mode string, size int64) error {
|
||||
if mode == "none" {
|
||||
return nil
|
||||
}
|
||||
return f.Truncate(size)
|
||||
}
|
||||
Reference in New Issue
Block a user