X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fpython-systemd%2F_daemon.c;h=3982e854264becf18b1b734651c1d973d627b4bc;hb=069f5e61eb128aa08b6fdff12fc6ac71c3897b48;hp=bd4e73e9be33a329f0099440bd406484a35cd981;hpb=925d98b3441881bad3a459cb5f7f3785bab40b5c;p=elogind.git diff --git a/src/python-systemd/_daemon.c b/src/python-systemd/_daemon.c index bd4e73e9b..3982e8542 100644 --- a/src/python-systemd/_daemon.c +++ b/src/python-systemd/_daemon.c @@ -40,28 +40,6 @@ PyDoc_STRVAR(module__doc__, "running under systemd." ); - -#if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 1 -static int Unicode_FSConverter(PyObject* obj, void *_result) { - PyObject **result = _result; - - assert(result); - - if (!obj) - /* cleanup: we don't return Py_CLEANUP_SUPPORTED, so - * we can assume that it was PyUnicode_FSConverter. */ - return PyUnicode_FSConverter(obj, result); - - if (obj == Py_None) { - *result = NULL; - return 1; - } - - return PyUnicode_FSConverter(obj, result); -} -#endif - - PyDoc_STRVAR(booted__doc__, "booted() -> bool\n\n" "Return True iff this system is running under systemd.\n" @@ -73,7 +51,7 @@ static PyObject* booted(PyObject *self, PyObject *args) { assert(args == NULL); r = sd_booted(); - if (set_error(r, NULL, NULL)) + if (set_error(r, NULL, NULL) < 0) return NULL; return PyBool_FromLong(r); @@ -110,7 +88,7 @@ static PyObject* notify(PyObject *self, PyObject *args, PyObject *keywds) { #endif r = sd_notify(unset, msg); - if (set_error(r, NULL, NULL)) + if (set_error(r, NULL, NULL) < 0) return NULL; return PyBool_FromLong(r); @@ -136,7 +114,7 @@ static PyObject* listen_fds(PyObject *self, PyObject *args, PyObject *keywds) { #else PyObject *obj = NULL; if (!PyArg_ParseTupleAndKeywords(args, keywds, "|O:_listen_fds", - (char**) kwlist, &unset, &obj)) + (char**) kwlist, &obj)) return NULL; if (obj != NULL) unset = PyObject_IsTrue(obj); @@ -145,7 +123,7 @@ static PyObject* listen_fds(PyObject *self, PyObject *args, PyObject *keywds) { #endif r = sd_listen_fds(unset); - if (set_error(r, NULL, NULL)) + if (set_error(r, NULL, NULL) < 0) return NULL; return long_FromLong(r); @@ -173,7 +151,7 @@ static PyObject* is_fifo(PyObject *self, PyObject *args) { #endif r = sd_is_fifo(fd, path); - if (set_error(r, path, NULL)) + if (set_error(r, path, NULL) < 0) return NULL; return PyBool_FromLong(r); @@ -201,7 +179,7 @@ static PyObject* is_mq(PyObject *self, PyObject *args) { #endif r = sd_is_mq(fd, path); - if (set_error(r, path, NULL)) + if (set_error(r, path, NULL) < 0) return NULL; return PyBool_FromLong(r); @@ -225,7 +203,7 @@ static PyObject* is_socket(PyObject *self, PyObject *args) { return NULL; r = sd_is_socket(fd, family, type, listening); - if (set_error(r, NULL, NULL)) + if (set_error(r, NULL, NULL) < 0) return NULL; return PyBool_FromLong(r); @@ -252,7 +230,7 @@ static PyObject* is_socket_inet(PyObject *self, PyObject *args) { } r = sd_is_socket_inet(fd, family, type, listening, (uint16_t) port); - if (set_error(r, NULL, NULL)) + if (set_error(r, NULL, NULL) < 0) return NULL; return PyBool_FromLong(r); @@ -287,7 +265,7 @@ static PyObject* is_socket_unix(PyObject *self, PyObject *args) { #endif r = sd_is_socket_unix(fd, type, listening, path, length); - if (set_error(r, path, NULL)) + if (set_error(r, path, NULL) < 0) return NULL; return PyBool_FromLong(r);