summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-22 20:41:21 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-22 20:57:12 -0400
commit8024fc61719d15b47ace1973b6b901881e17ff2f (patch)
tree070c02bbb8e61abc5c83501e9a53d4ae5baef358
parent35a5b281adea321ea3f7b7d688a994e735366fb0 (diff)
downloadpython-systemd-8024fc61719d15b47ace1973b6b901881e17ff2f.tar.gz
_reader: use proper ifdef guard for sd_j_open_files_fd
-rw-r--r--systemd/_reader.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/systemd/_reader.c b/systemd/_reader.c
index 0f6fd3f..3a2c218 100644
--- a/systemd/_reader.c
+++ b/systemd/_reader.c
@@ -283,7 +283,6 @@ static int Reader_init(Reader *self, PyObject *args, PyObject *keywds) {
Py_END_ALLOW_THREADS
}
} else if (_files) {
-#ifdef HAVE_JOURNAL_OPEN_FILES
_cleanup_Py_DECREF_ PyObject *item0 = NULL;
item0 = PySequence_GetItem(_files, 0);
@@ -293,9 +292,13 @@ static int Reader_init(Reader *self, PyObject *args, PyObject *keywds) {
if (!strv_converter(_files, &files))
return -1;
+#ifdef HAVE_JOURNAL_OPEN_FILES
Py_BEGIN_ALLOW_THREADS
r = sd_journal_open_files(&self->j, (const char**) files, flags);
Py_END_ALLOW_THREADS
+#else
+ r = -ENOSYS;
+#endif
} else {
_cleanup_free_ int *fds = NULL;
size_t n_fds;
@@ -303,13 +306,14 @@ static int Reader_init(Reader *self, PyObject *args, PyObject *keywds) {
if (!intlist_converter(_files, &fds, &n_fds))
return -1;
+#ifdef HAVE_JOURNAL_OPEN_DIRECTORY_FD
Py_BEGIN_ALLOW_THREADS
r = sd_journal_open_files_fd(&self->j, fds, n_fds, flags);
Py_END_ALLOW_THREADS
- }
#else
- r = -ENOSYS;
+ r = -ENOSYS;
#endif
+ }
} else {
Py_BEGIN_ALLOW_THREADS
r = sd_journal_open(&self->j, flags);