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:
parent
ac65af0669
commit
da1d4cc78a
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Building the installer is only tested and supported on 10.9+ with Xcode 6.0.1
|
# 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
|
# 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:
|
# 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)}"
|
SDK_PATH="${SDK_PATH:-$SDKS_PATH/$(ls -1 ${SDKS_PATH} | sort -n -k2 -t. -r | head -1)}"
|
||||||
|
|
||||||
# Set SDK path
|
# 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
|
# OpenSSL is deprecated on OSX since 10.7 and that generates lots of
|
||||||
# "false positive" warnings and there is no alternative option.
|
# "false positive" warnings and there is no alternative option.
|
||||||
|
|
|
@ -41,6 +41,12 @@
|
||||||
|
|
||||||
#include "pace.h"
|
#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 */
|
/* Logging */
|
||||||
#define PCSC_TRACE(reader, desc, rv) do { sc_log(reader->ctx, "%s:" desc ": 0x%08lx\n", reader->name, rv); } while (0)
|
#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)
|
#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))
|
if (check_forced_protocol(reader->ctx, &reader->atr, &tmp))
|
||||||
protocol = tmp;
|
protocol = tmp;
|
||||||
|
|
||||||
#ifndef HAVE_PCSCLITE_H
|
#ifndef HAVE_PCSCLITE
|
||||||
/* reconnect unlocks transaction everywhere but in PCSC-lite */
|
/* reconnect unlocks transaction everywhere but in PCSC-lite */
|
||||||
priv->locked = 0;
|
priv->locked = 0;
|
||||||
#endif
|
#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)
|
static int pcsc_reset(sc_reader_t *reader, int do_cold_reset)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
#ifndef HAVE_PCSCLITE_H
|
#ifndef HAVE_PCSCLITE
|
||||||
struct pcsc_private_data *priv = GET_PRIV_DATA(reader);
|
struct pcsc_private_data *priv = GET_PRIV_DATA(reader);
|
||||||
int old_locked = priv->locked;
|
int old_locked = priv->locked;
|
||||||
#endif
|
#endif
|
||||||
|
@ -600,7 +606,7 @@ static int pcsc_reset(sc_reader_t *reader, int do_cold_reset)
|
||||||
if(r != SC_SUCCESS)
|
if(r != SC_SUCCESS)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
#ifndef HAVE_PCSCLITE_H
|
#ifndef HAVE_PCSCLITE
|
||||||
/* reconnect unlocks transaction everywhere but in PCSC-lite */
|
/* reconnect unlocks transaction everywhere but in PCSC-lite */
|
||||||
if(old_locked)
|
if(old_locked)
|
||||||
r = pcsc_lock(reader);
|
r = pcsc_lock(reader);
|
||||||
|
@ -2492,4 +2498,3 @@ struct sc_reader_driver * sc_get_cardmod_driver(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ENABLE_PCSC */
|
#endif /* ENABLE_PCSC */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue