Check for NULL result from bpf_attach_kprobe
authorBrenden Blanco <bblanco@plumgrid.com>
Wed, 15 Jun 2016 03:57:03 +0000 (20:57 -0700)
committerBrenden Blanco <bblanco@plumgrid.com>
Wed, 15 Jun 2016 04:01:21 +0000 (21:01 -0700)
commit9964bf2cce8d2e347e243f2d9ec606a2dda6ceac
treec72e0313cc299b1e1bd4e00cbe3479d51e4cbd70
parentcfac8da4a2774d8959d9c5e0221c07f437c35452
Check for NULL result from bpf_attach_kprobe

The check for NULL in the return value from C functions was comparing to
None incorrectly, causing an error check to pass improperly. Simply
check the truthiness of the return instead seems to be more resilient.

Add a test as well.

Fixes: #568
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
src/python/bcc/__init__.py
tests/python/test_probe_count.py