Skip to content

Commit

Permalink
Merge pull request #2735 from AkihiroSuda/refactor-ftruncate
Browse files Browse the repository at this point in the history
osutil: remove Ftruncate
  • Loading branch information
jandubois authored Oct 15, 2024
2 parents 9705b66 + 9d971fc commit ca89d67
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
3 changes: 1 addition & 2 deletions pkg/nativeimgutil/nativeimgutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/lima-vm/go-qcow2reader"
"github.com/lima-vm/go-qcow2reader/image/qcow2"
"github.com/lima-vm/go-qcow2reader/image/raw"
"github.com/lima-vm/lima/pkg/osutil"
"github.com/lima-vm/lima/pkg/progressbar"
"github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -169,5 +168,5 @@ func MakeSparse(f *os.File, n int64) error {
if _, err := f.Seek(n, io.SeekStart); err != nil {
return err
}
return osutil.Ftruncate(int(f.Fd()), n)
return f.Truncate(n)
}
4 changes: 0 additions & 4 deletions pkg/osutil/osutil_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func Dup2(oldfd, newfd int) (err error) {
return unix.Dup2(oldfd, newfd)
}

func Ftruncate(fd int, length int64) (err error) {
return unix.Ftruncate(fd, length)
}

func SignalName(sig os.Signal) string {
return unix.SignalName(sig.(syscall.Signal))
}
4 changes: 0 additions & 4 deletions pkg/osutil/osutil_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ func Dup2(oldfd int, newfd syscall.Handle) (err error) {
return fmt.Errorf("unimplemented")
}

func Ftruncate(_ int, _ int64) (err error) {
return fmt.Errorf("unimplemented")
}

func SignalName(sig os.Signal) string {
switch sig {
case syscall.SIGINT:
Expand Down

0 comments on commit ca89d67

Please sign in to comment.