net: add missing error handling on Plan 9

This commit is contained in:
Leon Klingele 2019-01-30 18:14:16 +01:00
parent 56c9f8e8cf
commit fdad0e8764
No known key found for this signature in database
GPG Key ID: 0C8AF48831EEC211
1 changed files with 5 additions and 1 deletions

View File

@ -152,8 +152,12 @@ func interfaceAddrTable(ifi *Interface) ([]Addr, error) {
}
defer statusf.close()
// Read but ignore first line as it only contains the table header.
// See https://9p.io/magic/man2html/3/ip
if _, ok := statusf.readLine(); !ok {
return nil, errors.New("cannot read header line for interface: " + status)
}
line, ok := statusf.readLine()
line, ok = statusf.readLine()
if !ok {
return nil, errors.New("cannot parse IP address for interface: " + status)
}