Build fix: missing error_get_str on non-glibc builds
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 18 Apr 2023 15:29:21 +0000 (11:29 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 18 Apr 2023 15:43:51 +0000 (11:43 -0400)
The function declaration was erroneously moved inside this ifdef. This
breaks non glibc builds.

Introduced in :

  commit 003f455dab0204dd3f066ecdbea0470035f8181f
  Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
  Date:   Thu Apr 13 14:31:33 2023 -0400

    Fix: logging: unhandled error in *_FMT macros

    Coverity reports:

    1508779 Uncaught exception
    If the exception is ever thrown, the program will crash.

    In lttng::​sessiond::​rotation_thread::​_thread_function(): A C++ exception
    is thrown but never caught (CWE-248)

    The *_FMT macros, which use fmtlib, don't handle the case where
    fmt::format throws. This can happen, in particular, when an invalid
    format string is used.

    The macros are modified to log the exception and abort.

Change-Id: I5eb3b2a673e224f3c99cae7faece31175084db9d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/error.hpp

index d1996384db5c839cd2764e62d36dcb7d26e6499c..d00f4130923d8e0c0b6941343fcc90f4ec242525 100644 (file)
@@ -243,7 +243,6 @@ static inline void __lttng_print_check_abort(enum lttng_error_level type)
 /*
  * Version using GNU strerror_r, for linux with appropriate defines.
  */
-const char *error_get_str(int32_t code);
 #define PERROR(call, args...)                                                      \
        do {                                                                       \
                char *_perror_buf;                                                 \
@@ -253,6 +252,8 @@ const char *error_get_str(int32_t code);
        } while (0);
 #endif
 
+const char *error_get_str(int32_t code);
+
 namespace lttng {
 namespace logging {
 namespace details {
This page took 0.025356 seconds and 4 git commands to generate.