Fix locking issue on OS X

Works around Apple shipping PCSC-Lite headers without PCSC-Lite. Let's
say they do it for "backward compatibility"...
This commit is contained in:
Frank Morgner 2015-10-07 17:55:53 +02:00
parent ac65af0669
commit da1d4cc78a
2 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Building the installer is only tested and supported on 10.9+ with Xcode 6.0.1
# Built package targets 10.9+
# Built package targets 10.10
# Building should also work on older versions with older revisions or slight changes, YMMV
# You need to have the following from homebrew or macports or fink:
@ -15,7 +15,7 @@ SDKS_PATH="$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs"
SDK_PATH="${SDK_PATH:-$SDKS_PATH/$(ls -1 ${SDKS_PATH} | sort -n -k2 -t. -r | head -1)}"
# Set SDK path
export CFLAGS="-isysroot $SDK_PATH -arch i386 -arch x86_64 -mmacosx-version-min=10.7"
export CFLAGS="-isysroot $SDK_PATH -arch i386 -arch x86_64 -mmacosx-version-min=10.10"
# OpenSSL is deprecated on OSX since 10.7 and that generates lots of
# "false positive" warnings and there is no alternative option.

View File

@ -41,6 +41,12 @@
#include "pace.h"
#ifdef HAVE_PCSCLITE_H
#if !defined (__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
#define HAVE_PCSCLITE 1
#endif
#endif
/* Logging */
#define PCSC_TRACE(reader, desc, rv) do { sc_log(reader->ctx, "%s:" desc ": 0x%08lx\n", reader->name, rv); } while (0)
#define PCSC_LOG(ctx, desc, rv) do { sc_log(ctx, desc ": 0x%08lx\n", rv); } while (0)
@ -431,7 +437,7 @@ static int pcsc_reconnect(sc_reader_t * reader, DWORD action)
if (check_forced_protocol(reader->ctx, &reader->atr, &tmp))
protocol = tmp;
#ifndef HAVE_PCSCLITE_H
#ifndef HAVE_PCSCLITE
/* reconnect unlocks transaction everywhere but in PCSC-lite */
priv->locked = 0;
#endif
@ -591,7 +597,7 @@ static int pcsc_release(sc_reader_t *reader)
static int pcsc_reset(sc_reader_t *reader, int do_cold_reset)
{
int r;
#ifndef HAVE_PCSCLITE_H
#ifndef HAVE_PCSCLITE
struct pcsc_private_data *priv = GET_PRIV_DATA(reader);
int old_locked = priv->locked;
#endif
@ -600,7 +606,7 @@ static int pcsc_reset(sc_reader_t *reader, int do_cold_reset)
if(r != SC_SUCCESS)
return r;
#ifndef HAVE_PCSCLITE_H
#ifndef HAVE_PCSCLITE
/* reconnect unlocks transaction everywhere but in PCSC-lite */
if(old_locked)
r = pcsc_lock(reader);
@ -2492,4 +2498,3 @@ struct sc_reader_driver * sc_get_cardmod_driver(void)
#endif
#endif /* ENABLE_PCSC */