Fix CI suite warnings
This commit is contained in:
parent
4b5e8490bc
commit
033d24dbde
3 changed files with 5 additions and 5 deletions
|
|
@ -91,7 +91,7 @@ func CheckRunAsRoot() (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDeviceLogicalBlockSize(devPath string) (uint64, error) {
|
func GetDeviceLogicalBlockSize(devPath string) (uint64, error) {
|
||||||
fd, err := os.Open(devPath)
|
fd, err := os.Open(filepath.Clean(devPath))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, errors.Wrap(err, "open device")
|
return 0, errors.Wrap(err, "open device")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ import (
|
||||||
|
|
||||||
func getDeviceLogicalBlockSizeInner(fd uintptr) (int64, error) {
|
func getDeviceLogicalBlockSizeInner(fd uintptr) (int64, error) {
|
||||||
var bs int64
|
var bs int64
|
||||||
_, _, serr := unix.Syscall(unix.SYS_IOCTL, fd, unix.BLKSSZGET, uintptr(unsafe.Pointer(&bs)))
|
_, _, serr := unix.Syscall(unix.SYS_IOCTL, fd, unix.BLKSSZGET, uintptr(unsafe.Pointer(&bs))) // #nosec G103 It's safe.
|
||||||
if serr != 0 {
|
if serr != 0 {
|
||||||
return 0, errors.Wrap(serr, "syscall get logical block size")
|
return 0, errors.Wrap(serr, "syscall get logical block size")
|
||||||
}
|
}
|
||||||
|
|
||||||
return int64(bs), nil
|
return bs, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue