Commit dc045522 authored by Leon Klingele's avatar Leon Klingele Committed by Brad Fitzpatrick

net: explain why we ignore the first line of Plan 9 interface-status files

Change-Id: Ia0847790a597c35ebb572db6fc1b7534ecf8f006
GitHub-Last-Rev: 03f039d0abbce0e2a2bf15201948e46354950a22
GitHub-Pull-Request: golang/go#30022
Reviewed-on: https://go-review.googlesource.com/c/160446Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 97f81572
......@@ -152,10 +152,14 @@ 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)
return nil, errors.New("cannot read IP address for interface: " + status)
}
// This assumes only a single address for the interface.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment