I suppose KeyError would be reasonable. I'll redo the patch. --Andy
On Fri, Nov 8, 2013 at 10:47 AM, Paul Moore <[email protected]> wrote: > On Tuesday, November 05, 2013 11:36:40 AM Andy Lutomirski wrote: >> Signed-off-by: Andy Lutomirski <[email protected]> >> --- >> src/python/seccomp.pyx | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/src/python/seccomp.pyx b/src/python/seccomp.pyx >> index f09dcbf..f0acd7c 100644 >> --- a/src/python/seccomp.pyx >> +++ b/src/python/seccomp.pyx >> @@ -110,10 +110,16 @@ def resolve_syscall(arch, syscall): >> Resolve an architecture's syscall name to the correct number or the >> syscall number to the correct name. >> """ >> + cdef char *ret_str >> + >> if (isinstance(syscall, basestring)): >> return libseccomp.seccomp_syscall_resolve_name_arch(arch, syscall) >> elif (isinstance(syscall, int)): >> - return libseccomp.seccomp_syscall_resolve_num_arch(arch, syscall) >> + ret_str = libseccomp.seccomp_syscall_resolve_num_arch(arch, >> syscall) + if ret_str is NULL: >> + return None >> + else: >> + return ret_str > > Would it be better to raise an error here? > >> else: >> raise TypeError("Syscall must either be an int or str type") > > -- > paul moore > security and virtualization @ redhat > -- Andy Lutomirski AMA Capital Management, LLC ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ libseccomp-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libseccomp-discuss
