Commit 4ddedda5 authored by Quentin Monnet's avatar Quentin Monnet

python: With DEBUG_BPF, print BPF error even if log_buf is not empty.

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: default avatarQuentin Monnet <quentin.monnet@6wind.com>
parent bb699887
......@@ -211,7 +211,7 @@ class BPF(object):
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))
......
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