]> git.ipfire.org Git - pakfire.git/commitdiff
capabilities: Ignore EOPNOTSUPP.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 20 Nov 2011 09:59:09 +0000 (10:59 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 20 Nov 2011 09:59:09 +0000 (10:59 +0100)
Also fixes SEGV in capabilities module, when an exception is raised.

python/src/capabilities.c

index c33607a7fa0cee6653175f0e2138c6fd3e0653d8..fb5574d134dec9aa971b5eec81b6ce327b8828c1 100644 (file)
@@ -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);