Skip to content

Commit

Permalink
pkg/util/ebpf : fix error value.
Browse files Browse the repository at this point in the history
Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Aug 19, 2022
1 parent f16f9da commit cb58269
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/util/ebpf/bpf_androidgki.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,19 @@ func getAndroidConfig(filename string) (map[string]string, error) {
if i != 2 {
return KernelConfig, fmt.Errorf("read %d bytes, expected 2", i)
}

var s *bufio.Scanner
_, err = f.Seek(0, 0)
if err != nil {
return KernelConfig, err
}

var s *bufio.Scanner
// big-endian magic number for gzip is 0x1f8b
// little-endian magic number for gzip is 0x8b1f
if (magic[0] == 0x1f && magic[1] == 0x8b) || (magic[0] == 0x8b && magic[1] == 0x1f) {
var reader *gzip.Reader
//magic number for gzip is 0x1f8b
if magic[0] == 0x1f && magic[1] == 0x8b {
// gzip file
reader, e := gzip.NewReader(f)
if e != nil {
reader, err = gzip.NewReader(f)
if err != nil {
return KernelConfig, err
}
s = bufio.NewScanner(reader)
Expand Down

0 comments on commit cb58269

Please sign in to comment.