@cryptotaxi247 / netdata-1 / commits / 53d4c224e

when the namespace socket does not work, continue trying (#16458)

Costa Tsaousis committed Nov 22, 2023 at 20:03 UTC 53d4c224eaf4b9c5b69f2b5d6bcc7873e31fca75
1 file changed +12 -6
libnetdata/log/log.c
+12 -6
@@ -687,25 +687,31 @@ static bool nd_log_journal_direct_init(const char *path) {
687 return true;
688 }
689
690 + int fd;
691 char filename[FILENAME_MAX + 1];
692 if(!is_path_unix_socket(path)) {
693 +
694 journal_construct_path(filename, sizeof(filename), netdata_configured_host_prefix, "netdata");
693 - if (!is_path_unix_socket(filename)) {
695 + if (!is_path_unix_socket(filename) || (fd = journal_direct_fd(filename)) == -1) {
696 +
697 journal_construct_path(filename, sizeof(filename), netdata_configured_host_prefix, NULL);
695 - if (!is_path_unix_socket(filename)) {
698 + if (!is_path_unix_socket(filename) || (fd = journal_direct_fd(filename)) == -1) {
699 +
700 journal_construct_path(filename, sizeof(filename), NULL, "netdata");
697 - if (!is_path_unix_socket(filename)) {
701 + if (!is_path_unix_socket(filename) || (fd = journal_direct_fd(filename)) == -1) {
702 +
703 journal_construct_path(filename, sizeof(filename), NULL, NULL);
699 - if (!is_path_unix_socket(filename))
704 + if (!is_path_unix_socket(filename) || (fd = journal_direct_fd(filename)) == -1)
705 return false;
706 }
707 }
708 }
709 }
705 - else
710 + else {
711 snprintfz(filename, sizeof(filename), "%s", path);
712 + fd = journal_direct_fd(filename);
713 + }
714
708 - int fd = journal_direct_fd(filename);
715 if(fd < 0)
716 return false;
717