[Pkg-privacy-commits] [torsocks] 10/38: Use seconds since epoch, not local time, for log timestamps.
Intrigeri
intrigeri at moszumanska.debian.org
Thu Jun 23 15:18:23 UTC 2016
This is an automated email from the git hooks/post-receive script.
intrigeri pushed a commit to branch experimental/master
in repository torsocks.
commit 35187508cfaf3fd21ed68159f4635ee2d376aea4
Author: Taylor R Campbell <campbell+torsocks at mumble.net>
Date: Fri Jun 19 04:23:36 2015 +0000
Use seconds since epoch, not local time, for log timestamps.
Local time may require opening files to load the time zone database, which
leads to a potential deadlock-against-self when intercepting a close() in the
middle of tsocks_once initialization for close().
The same issue applies even if we use UTC, via gmtime.
Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
src/common/log.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/common/log.c b/src/common/log.c
index b68d66b..8bf8836 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -47,14 +47,12 @@ int tsocks_loglevel = DEFAULT_LOG_LEVEL;
static size_t add_time_to_log(char *buf, size_t len)
{
time_t now;
- const struct tm *tm;
assert(buf);
/* Get time stamp. */
time(&now);
- tm = localtime(&now);
- return strftime(buf, len, "[%b %d %H:%M:%S] ", tm);
+ return snprintf(buf, len, "%llu ", (unsigned long long)now);
}
/*
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torsocks.git
More information about the Pkg-privacy-commits
mailing list