Skip to content

Commit 8024fc6

Browse files
committed
_reader: use proper ifdef guard for sd_j_open_files_fd
1 parent 35a5b28 commit 8024fc6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

systemd/_reader.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ static int Reader_init(Reader *self, PyObject *args, PyObject *keywds) {
283283
Py_END_ALLOW_THREADS
284284
}
285285
} else if (_files) {
286-
#ifdef HAVE_JOURNAL_OPEN_FILES
287286
_cleanup_Py_DECREF_ PyObject *item0 = NULL;
288287

289288
item0 = PySequence_GetItem(_files, 0);
@@ -293,23 +292,28 @@ static int Reader_init(Reader *self, PyObject *args, PyObject *keywds) {
293292
if (!strv_converter(_files, &files))
294293
return -1;
295294

295+
#ifdef HAVE_JOURNAL_OPEN_FILES
296296
Py_BEGIN_ALLOW_THREADS
297297
r = sd_journal_open_files(&self->j, (const char**) files, flags);
298298
Py_END_ALLOW_THREADS
299+
#else
300+
r = -ENOSYS;
301+
#endif
299302
} else {
300303
_cleanup_free_ int *fds = NULL;
301304
size_t n_fds;
302305

303306
if (!intlist_converter(_files, &fds, &n_fds))
304307
return -1;
305308

309+
#ifdef HAVE_JOURNAL_OPEN_DIRECTORY_FD
306310
Py_BEGIN_ALLOW_THREADS
307311
r = sd_journal_open_files_fd(&self->j, fds, n_fds, flags);
308312
Py_END_ALLOW_THREADS
309-
}
310313
#else
311-
r = -ENOSYS;
314+
r = -ENOSYS;
312315
#endif
316+
}
313317
} else {
314318
Py_BEGIN_ALLOW_THREADS
315319
r = sd_journal_open(&self->j, flags);

0 commit comments

Comments
 (0)