Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
memory: Add extra check for memory file
Browse files Browse the repository at this point in the history
Error if total memory is blank.

Signed-off-by: James O. D. Hunt <[email protected]>
  • Loading branch information
jodh-intel committed Jul 18, 2019
1 parent 581bcf2 commit cd2f994
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,9 @@ func getMemory() (string, error) {
}

memTotal := strings.TrimSpace(fields[1])
if memTotal == "" {
return "", fmt.Errorf("cannot determine total memory from line %q", line)
}

return memTotal, nil
}
Expand Down

0 comments on commit cd2f994

Please sign in to comment.