From 4ddedda584abcd3f9c1b8843f2e059014fd1d94f Mon Sep 17 00:00:00 2001 From: Quentin Monnet Date: Thu, 9 Jun 2016 14:55:29 +0200 Subject: [PATCH] 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: Quentin Monnet --- src/python/bcc/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py index b9259df..882e43a 100644 --- a/src/python/bcc/__init__.py +++ b/src/python/bcc/__init__.py @@ -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)) -- 2.7.4