Skip to content

Commit 96c346e

Browse files
authored
Merge pull request #3522 from clwluvw/hidden-device
sysfs: trim spaces in device hidden check
2 parents c15f44e + 34f50e5 commit 96c346e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

utils/sysfs/sysfs.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,8 @@ func (fs *realSysFs) IsBlockDeviceHidden(name string) (bool, error) {
254254
if err != nil {
255255
return false, fmt.Errorf("failed to read %s: %w", devHiddenPath, err)
256256
}
257-
if string(hidden) == "1" {
258-
return true, nil
259-
}
260-
return false, nil
257+
258+
return strings.TrimSpace(string(hidden)) == "1", nil
261259
}
262260

263261
func (fs *realSysFs) GetBlockDeviceScheduler(name string) (string, error) {

0 commit comments

Comments
 (0)