diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-05-09 18:10:30 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-05-09 18:13:33 -0400 |
commit | 7ecec4705c0cacb1446af0eb7a4aee66c00d058f (patch) | |
tree | 9761c582b900067bca3e69c6f22f18e77fa70385 /src/python-systemd/_reader.c | |
parent | b3af9646f8ac23e73fe1d7af3b69e35b1547b13e (diff) |
systemd-python: wrap sd_login_monitor
Diffstat (limited to 'src/python-systemd/_reader.c')
-rw-r--r-- | src/python-systemd/_reader.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c index d20c58d2a8..c4c4fdfe1d 100644 --- a/src/python-systemd/_reader.c +++ b/src/python-systemd/_reader.c @@ -38,20 +38,6 @@ typedef struct { } Reader; static PyTypeObject ReaderType; -static int set_error(int r, const char* path, const char* invalid_message) { - if (r >= 0) - return r; - if (r == -EINVAL && invalid_message) - PyErr_SetString(PyExc_ValueError, invalid_message); - else if (r == -ENOMEM) - PyErr_SetString(PyExc_MemoryError, "Not enough memory"); - else { - errno = -r; - PyErr_SetFromErrnoWithFilename(PyExc_OSError, path); - } - return -1; -} - PyDoc_STRVAR(module__doc__, "Class to reads the systemd journal similar to journalctl."); @@ -177,7 +163,7 @@ PyDoc_STRVAR(Reader_get_timeout__doc__, "Returns a timeout value for usage in poll(), the time since the\n" "epoch of clock_gettime(2) in microseconds, or None if no timeout\n" "is necessary.\n\n" - "The return value must be converted to a relative timeout in \n" + "The return value must be converted to a relative timeout in\n" "milliseconds if it is to be used as an argument for poll().\n" "See man:sd_journal_get_timeout(3) for further discussion."); static PyObject* Reader_get_timeout(Reader *self, PyObject *args) @@ -275,11 +261,7 @@ PyDoc_STRVAR(Reader___exit____doc__, "Closes the journal.\n"); static PyObject* Reader___exit__(Reader *self, PyObject *args) { - assert(self); - - sd_journal_close(self->j); - self->j = NULL; - Py_RETURN_NONE; + return Reader_close(self, args); } |