diff options
-rw-r--r-- | collectors/plugins.d/local_listeners.c | 2 | ||||
-rw-r--r-- | libnetdata/log/log.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/collectors/plugins.d/local_listeners.c b/collectors/plugins.d/local_listeners.c index a45fe3c97a..a39de79748 100644 --- a/collectors/plugins.d/local_listeners.c +++ b/collectors/plugins.d/local_listeners.c @@ -42,7 +42,7 @@ static inline const char *protocol_name(PROC_NET_PROTOCOLS protocol) { static inline int read_cmdline(pid_t pid, char* buffer, size_t bufferSize) { char path[FILENAME_MAX + 1]; - snprintfz(path, FILENAME_MAX, "/proc/%d/cmdline", pid); + snprintfz(path, FILENAME_MAX, "%s/proc/%d/cmdline", netdata_configured_host_prefix, pid); FILE* file = fopen(path, "r"); if (!file) { diff --git a/libnetdata/log/log.c b/libnetdata/log/log.c index 0ce989457b..02b9edc8f5 100644 --- a/libnetdata/log/log.c +++ b/libnetdata/log/log.c @@ -634,7 +634,7 @@ int error_log_limit(int reset) { static time_t start = 0; static unsigned long counter = 0, prevented = 0; - FILE *fp = stderror; + FILE *fp = stderror ? stderror : stderr; // fprintf(fp, "FLOOD: counter=%lu, allowed=%lu, backup=%lu, period=%llu\n", counter, error_log_errors_per_period, error_log_errors_per_period_backup, (unsigned long long)error_log_throttle_period); @@ -841,7 +841,7 @@ static const char *strerror_result_string(const char *a, const char *b) { (void) #endif void error_limit_int(ERROR_LIMIT *erl, const char *prefix, const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, const char *fmt, ... ) { - FILE *fp = stderror; + FILE *fp = stderror ? stderror : stderr; if(erl->sleep_ut) sleep_usec(erl->sleep_ut); @@ -975,7 +975,7 @@ static void print_call_stack(void) { #endif void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) { - FILE *fp = stderror; + FILE *fp = stderror ? stderror : stderr; // save a copy of errno - just in case this function generates a new error int __errno = errno; |