From 23a6c138f26e40eda36e71a3ef3253ab3ea13652 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 29 Jun 2024 17:05:33 -0700 Subject: [PATCH] pcsc-lite: fix formats under musl pthread_t is a pointer. Signed-off-by: Rosen Penev --- src/debuglog.c | 2 +- src/spy/libpcscspy.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/debuglog.c b/src/debuglog.c index 69045b53..86d7b9f2 100644 --- a/src/debuglog.c +++ b/src/debuglog.c @@ -262,7 +262,7 @@ static void log_line(const int priority, const char *DebugBuffer, break; } -#ifdef __APPLE__ +#ifndef __GLIBC__ #define THREAD_FORMAT "%p" #else #define THREAD_FORMAT "%lu" diff --git a/src/spy/libpcscspy.c b/src/spy/libpcscspy.c index e7bff92e..7719e428 100644 --- a/src/spy/libpcscspy.c +++ b/src/spy/libpcscspy.c @@ -121,7 +121,7 @@ static void spy_line_direct(char *line) if (Log_fd < 0) return; - snprintf(threadid, sizeof threadid, "%lX@", pthread_self()); + snprintf(threadid, sizeof threadid, "%lX@", (unsigned long)pthread_self()); pthread_mutex_lock(&Log_fd_mutex); r = write(Log_fd, threadid, strlen(threadid)); r = write(Log_fd, line, strlen(line)); @@ -150,7 +150,7 @@ static void spy_line(const char *fmt, ...) printf("libpcsc-spy: Buffer is too small!\n"); return; } - snprintf(threadid, sizeof threadid, "%lX@", pthread_self()); + snprintf(threadid, sizeof threadid, "%lX@", (unsigned long)pthread_self()); pthread_mutex_lock(&Log_fd_mutex); r = write(Log_fd, threadid, strlen(threadid)); r = write(Log_fd, line, size);