Subject: [PATCH 2/3] Fix zero key_thread_attempt_id case --- a/lib/log.c +++ b/lib/log.c @@ -38,7 +38,7 @@ char buffer[ATTEMPT_ID_SIZE + 1]; char *prefixed_msg = NULL; - attempt_id = pthread_getspecific(key_thread_attempt_id); + attempt_id = key_thread_attempt_id ? pthread_getspecific(key_thread_attempt_id) : 0; if (attempt_id) { int len = sizeof(buffer) + 1 + strlen(msg) + 1; .