From b5f9a4654516e0ec37373e198e6b3a6f6a2a186d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 18 Dec 2006 12:03:14 +0100 Subject: [PATCH] Use thread ID for temporary file creation. --- lib/fb-temp.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/fb-temp.c b/lib/fb-temp.c index aa1689c4..7162fd2e 100644 --- a/lib/fb-temp.c +++ b/lib/fb-temp.c @@ -32,18 +32,13 @@ static void CONSTRUCTOR temp_global_init(void) void temp_file_name(byte *buf) { - int cnt = ++ucwlib_thread_context()->temp_counter; + struct ucwlib_context *ctx = ucwlib_thread_context(); + int cnt = ++ctx->temp_counter; int pid = getpid(); -#if 0 - /* FIXME: This is Linux-specific and not declared anywhere :( */ - int tid = gettid(); -#else - int tid = pid; -#endif - if (pid == tid) + if (ctx->thread_id == pid) sprintf(buf, "%s%d-%d", temp_prefix, pid, cnt); else - sprintf(buf, "%s%d-%d-%d", temp_prefix, pid, tid, cnt); + sprintf(buf, "%s%d-%d-%d", temp_prefix, pid, ctx->thread_id, cnt); } struct fastbuf * -- 2.39.2