@cryptotaxi247 / netdata-1 / commits / 2510da525

dont use sd_journal_open_files_fd() that is buggy on older libsystemd (#16090)

Costa Tsaousis committed Oct 2, 2023 at 21:23 UTC 2510da5252a82cdda790f1d43d6258c998d3cbaa
1 file changed +15 -15
collectors/systemd-journal.plugin/systemd-journal.c
+15 -15
@@ -581,16 +581,16 @@ static ND_SD_JOURNAL_STATUS netdata_systemd_journal_query_one_file(
581 sd_journal *j = NULL;
582 errno = 0;
583
584 -#ifdef HAVE_SD_JOURNAL_OPEN_FILES_FD
585 - int fd = open(filename, O_RDONLY);
586 - fstat_cache_enable(fd);
587 -
588 - if(sd_journal_open_files_fd(&j, &fd, 1, ND_SD_JOURNAL_OPEN_FLAGS) < 0 || !j) {
589 - fqs->cached_count += fstat_cache_disable(fd);
590 - close(fd);
591 - return ND_SD_JOURNAL_FAILED_TO_OPEN;
592 - }
593 -#else // !HAVE_SD_JOURNAL_OPEN_FILES_FD
584 +//#ifdef HAVE_SD_JOURNAL_OPEN_FILES_FD
585 +// int fd = open(filename, O_RDONLY);
586 +// fstat_cache_enable(fd);
587 +//
588 +// if(sd_journal_open_files_fd(&j, &fd, 1, ND_SD_JOURNAL_OPEN_FLAGS) < 0 || !j) {
589 +// fqs->cached_count += fstat_cache_disable(fd);
590 +// close(fd);
591 +// return ND_SD_JOURNAL_FAILED_TO_OPEN;
592 +// }
593 +//#else // !HAVE_SD_JOURNAL_OPEN_FILES_FD
594
595 const char *paths[2] = {
596 [0] = filename,
@@ -599,7 +599,7 @@ static ND_SD_JOURNAL_STATUS netdata_systemd_journal_query_one_file(
599 if(sd_journal_open_files(&j, paths, ND_SD_JOURNAL_OPEN_FLAGS) < 0 || !j)
600 return ND_SD_JOURNAL_FAILED_TO_OPEN;
601
602 -#endif // !HAVE_SD_JOURNAL_OPEN_FILES_FD
602 +//#endif // !HAVE_SD_JOURNAL_OPEN_FILES_FD
603
604 ND_SD_JOURNAL_STATUS status;
605 bool matches_filters = true;
@@ -626,10 +626,10 @@ static ND_SD_JOURNAL_STATUS netdata_systemd_journal_query_one_file(
626
627 sd_journal_close(j);
628
629 -#ifdef HAVE_SD_JOURNAL_OPEN_FILES_FD
630 - fqs->cached_count += fstat_cache_disable(fd);
631 - close(fd);
632 -#endif
629 +//#ifdef HAVE_SD_JOURNAL_OPEN_FILES_FD
630 +// fqs->cached_count += fstat_cache_disable(fd);
631 +// close(fd);
632 +//#endif
633
634 return status;
635 }