Skip to content

Commit

Permalink
python: With DEBUG_BPF, print BPF error even if log_buf is not empty.
Browse files Browse the repository at this point in the history
When BPF syscall fails and DEBUG_FLAG has been provided to a Python
caller script, the BPF error string would be printed only if log_buf had
not been filled by the kernel. This commit removes this requirement,
printing the error string even if log_buf is not empty.

Signed-off-by: Quentin Monnet <[email protected]>
  • Loading branch information
qmonnet committed Jun 13, 2016
1 parent bb69988 commit 4ddedda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/python/bcc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def load_func(self, func_name, prog_type):
print(log_buf.value.decode(), file=sys.stderr)

if fd < 0:
if self.debug & DEBUG_BPF and not log_buf.value:
if self.debug & DEBUG_BPF:
errstr = os.strerror(ct.get_errno())
raise Exception("Failed to load BPF program %s: %s" %
(func_name, errstr))
Expand Down

0 comments on commit 4ddedda

Please sign in to comment.