X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcommon%2Ferror.c;h=a13320f6857714eaf4cd123185dc7befa1ef0802;hb=9f1053713656f28d01552540067b8887546a574c;hp=c79ce571319e4e23a382007ba99b6d120a77a1d7;hpb=44a019c230262b94d8cbd2075cfbebccbe75dfc1;p=lttng-tools.git diff --git a/src/common/error.c b/src/common/error.c index c79ce5713..a13320f68 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; + 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 ""; }