Skip to content

Commit

Permalink
Merge pull request #1575 from shirou/feat/fix_disk_unix_uint64cast
Browse files Browse the repository at this point in the history
[linux][disk]: fix Rdev cast
  • Loading branch information
shirou authored Jan 14, 2024
2 parents 8aa43a2 + 13218ce commit 442e0ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build_test: ## test only buildable
GOOS=linux GOARCH=loong64 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=linux GOARCH=riscv64 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=linux GOARCH=s390x go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=linux GOARCH=mips go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=freebsd GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=freebsd GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=freebsd GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)
Expand Down
8 changes: 4 additions & 4 deletions disk/disk_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,8 @@ func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
if err := unix.Stat(name, &stat); err != nil {
return "", err
}
major := unix.Major(stat.Rdev)
minor := unix.Minor(stat.Rdev)
major := unix.Major(uint64(stat.Rdev))
minor := unix.Minor(uint64(stat.Rdev))

sserial, _ := udevData(ctx, major, minor, "E:ID_SERIAL")
if sserial != "" {
Expand Down Expand Up @@ -541,8 +541,8 @@ func LabelWithContext(ctx context.Context, name string) (string, error) {
if err := unix.Stat(common.HostDevWithContext(ctx, name), &stat); err != nil {
return "", err
}
major := unix.Major(stat.Rdev)
minor := unix.Minor(stat.Rdev)
major := unix.Major(uint64(stat.Rdev))
minor := unix.Minor(uint64(stat.Rdev))

label, err := udevData(ctx, major, minor, "E:ID_FS_LABEL")
if err != nil {
Expand Down

0 comments on commit 442e0ad

Please sign in to comment.