summaryrefslogtreecommitdiff
path: root/systemd/_reader.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-09-04 17:05:08 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-09-04 17:16:28 +0200
commitf83dea9f8d74da509befb9d1cca269ab1686ab1a (patch)
tree633f1754db02caddc3d75107869d9001fcdec1d8 /systemd/_reader.c
parentc71fbb58e52e93e5aa1b18257a7a236d22f9a594 (diff)
downloadpython-systemd-f83dea9f8d74da509befb9d1cca269ab1686ab1a.tar.gz
Add compatibility with systemd < 205
Diffstat (limited to 'systemd/_reader.c')
-rw-r--r--systemd/_reader.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/systemd/_reader.c b/systemd/_reader.c
index 671170d..58ee04c 100644
--- a/systemd/_reader.c
+++ b/systemd/_reader.c
@@ -31,6 +31,13 @@
#include "macro.h"
#include "strv.h"
+#if defined(LIBSYSTEMD_VERSION) || LIBSYSTEMD_JOURNAL_VERSION > 204
+# define HAVE_JOURNAL_OPEN_FILES
+#else
+# define SD_JOURNAL_SYSTEM 4
+# define SD_JOURNAL_CURRENT_USER 8
+#endif
+
typedef struct {
PyObject_HEAD
sd_journal *j;
@@ -170,9 +177,13 @@ static int Reader_init(Reader *self, PyObject *args, PyObject *keywds) {
Py_BEGIN_ALLOW_THREADS
if (path)
r = sd_journal_open_directory(&self->j, path, 0);
- else if (files)
+ else if (files) {
+#ifdef HAVE_JOURNAL_OPEN_FILES
r = sd_journal_open_files(&self->j, (const char**) files, 0);
- else
+#else
+ r = -ENOSYS;
+#endif
+ } else
r = sd_journal_open(&self->j, flags);
Py_END_ALLOW_THREADS