| From 8024fc61719d15b47ace1973b6b901881e17ff2f Mon Sep 17 00:00:00 2001 |
| From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> |
| Date: Thu, 22 Sep 2016 20:41:21 -0400 |
| Subject: [PATCH 5/6] _reader: use proper ifdef guard for sd_j_open_files_fd |
| |
| --- |
| systemd/_reader.c | 10 +++++++--- |
| 1 file 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); |
| -- |
| 2.10.0 |
| |