Fix CI suite warnings

This commit is contained in:
AlexSSD7 2023-09-27 13:42:48 +01:00
commit 033d24dbde
3 changed files with 5 additions and 5 deletions

View file

@ -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")
} }

View file

@ -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
} }