$OpenBSD: patch-src_spy_libpcscspy_c,v 1.4 2015/12/27 18:05:49 dcoppa Exp $
--- src/spy/libpcscspy.c.orig	Fri Nov  6 09:39:51 2015
+++ src/spy/libpcscspy.c	Sun Dec 27 18:52:28 2015
@@ -26,6 +26,7 @@
 #include <unistd.h>
 #include <sys/time.h>
 #include <pthread.h>
+#include <inttypes.h>
 
 #include "misc.h"
 #include <winscard.h>
@@ -167,7 +168,7 @@ static void spy_line_direct(char *line)
 	if (Log_fd < 0)
 		return;
 
-	snprintf(threadid, sizeof threadid, "%lX@", pthread_self());
+	snprintf(threadid, sizeof threadid, "%" PRIXPTR "@", (uintptr_t)pthread_self());
 	pthread_mutex_lock(&Log_fd_mutex);
 	r = write(Log_fd, threadid, strlen(threadid));
 	r = write(Log_fd, line, strlen(line));
@@ -196,7 +197,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, "%" PRIXPTR "@", (uintptr_t)pthread_self());
 	pthread_mutex_lock(&Log_fd_mutex);
 	r = write(Log_fd, threadid, strlen(threadid));
 	r = write(Log_fd, line, size);
