protocol/rtsp: checking error from scans

This commit is contained in:
Saxon 2019-04-28 12:27:54 +09:30
parent 39d0b5d6da
commit 9abcfb138b
1 changed files with 8 additions and 2 deletions

View File

@ -141,12 +141,18 @@ func ReadResponse(r io.Reader) (*Response, error) {
} }
var proto string var proto string
fmt.Sscanf(s, "%s %d %s", &proto, &resp.StatusCode, &resp.Status) _, err = fmt.Sscanf(s, "%s %d %s", &proto, &resp.StatusCode, &resp.Status)
if err != nil {
return nil, err
}
s1 := strings.Split(proto, "/") s1 := strings.Split(proto, "/")
resp.Proto = s1[0] resp.Proto = s1[0]
fmt.Sscanf(s1[1], "%d.%d", &resp.ProtoMajor, &resp.ProtoMinor) _, err = fmt.Sscanf(s1[1], "%d.%d", &resp.ProtoMajor, &resp.ProtoMinor)
if err != nil {
return nil, err
}
// Read headers. // Read headers.
for { for {