X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Ferror.c;h=4ea8e08607c6067a6bffa645c5bf2e377823dc14;hb=23649f1186d370ae42454b8f82c09ae77c5dbaf1;hp=eed6aecaf14af22efbd20460db6c49704aa500a9;hpb=d49b54aade558422c35ecf9d62a33bf19b80cc51;p=lttng-tools.git diff --git a/src/common/error.c b/src/common/error.c index eed6aecaf..4ea8e0860 100644 --- a/src/common/error.c +++ b/src/common/error.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,7 @@ const char *log_add_time(void) struct tm tm, *res; struct timespec tp; time_t now; + const int errsv = errno; ret = lttng_clock_gettime(CLOCK_REALTIME, &tp); if (ret < 0) { @@ -65,10 +67,12 @@ const char *log_add_time(void) goto error; } + errno = errsv; return URCU_TLS(error_log_time).str; error: /* Return an empty string on error so logging is not affected. */ + errno = errsv; return ""; }