Skip to content

Commit e360783

Browse files
authored
Merge pull request #49 from DmytroLinkin/master
Trim spaces when reading sfnum file in GetSfIndexByAuxDev()
2 parents bf007ca + 07a0080 commit e360783

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sriovnet_aux.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"fmt"
2424
"path/filepath"
2525
"strconv"
26+
"strings"
2627

2728
utilfs "github.com/Mellanox/sriovnet/pkg/utils/filesystem"
2829
)
@@ -47,7 +48,7 @@ func GetSfIndexByAuxDev(auxDev string) (int, error) {
4748
return -1, fmt.Errorf("cannot read sfnum file for %s device: %v", auxDev, err)
4849
}
4950

50-
sfnum, err := strconv.Atoi(string(sfNumStr))
51+
sfnum, err := strconv.Atoi(strings.TrimSpace(string(sfNumStr)))
5152
if err != nil {
5253
return -1, err
5354
}

0 commit comments

Comments
 (0)