@@ -33,10 +33,14 @@ # include #endif #ifdef HAVE_STDIO_H # include #endif +#define HAVE_ERRNO_H 1 +#ifdef HAVE_ERRNO_H +# include +#endif #ifdef HAVE_ZLIB_H # ifdef HAVE_LIBZ # include # endif #else @@ -4391,10 +4395,11 @@ } } /* Determine list of readers */ pcsc_connect_ret = cackey_pcsc_connect(); +/* XXX: CAN HANG HERE ! */ if (pcsc_connect_ret != CACKEY_PCSC_S_OK) { CACKEY_DEBUG_PRINTF("Connection to PC/SC failed, assuming no slots"); slot_count = 0; } else { @@ -5307,10 +5312,16 @@ if (fgets_ret == NULL) { pinbuf[0] = '\0'; } pclose_ret = pclose(pinfd); + if (pclose_ret == -1 && errno == ECHILD) { + CACKEY_DEBUG_PRINTF("Notice. pclose() indicated it could not get the status of the child, assuming it succeeeded !"); + + pclose_ret = 0; + } + if (pclose_ret != 0) { CACKEY_DEBUG_PRINTF("Error. %s: exited with non-zero status of %i", pincmd, pclose_ret); if (lock_mutex) { cackey_mutex_unlock(cackey_biglock);