From: Michael Tremer Date: Sun, 20 Nov 2011 09:59:09 +0000 (+0100) Subject: capabilities: Ignore EOPNOTSUPP. X-Git-Tag: 0.9.18~14^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae613d8298280e48adfdf255859c1e65f47cc610;p=pakfire.git capabilities: Ignore EOPNOTSUPP. Also fixes SEGV in capabilities module, when an exception is raised. --- diff --git a/python/src/capabilities.c b/python/src/capabilities.c index c33607a7f..fb5574d13 100644 --- a/python/src/capabilities.c +++ b/python/src/capabilities.c @@ -29,7 +29,7 @@ PyObject * get_capabilities(PyObject *self, PyObject *args) { const char *filename; cap_t cap_d; - char *exception = NULL; + char exception[STRING_SIZE]; if (!PyArg_ParseTuple(args, "s", &filename)) { /* XXX raise exception */ @@ -38,7 +38,10 @@ get_capabilities(PyObject *self, PyObject *args) { cap_d = cap_get_file(filename); if (cap_d == NULL) { - if (errno != ENODATA) { + if (errno == EOPNOTSUPP) { + /* Return nothing, if the operation is not supported. */ + Py_RETURN_NONE; + } else if (errno != ENODATA) { snprintf(exception, STRING_SIZE - 1, "Failed to get capabilities of file %s (%s).", filename, strerror(errno)); PyErr_SetString(PyExc_RuntimeError, exception);