Diff

Differences From Artifact [3de1a30e4b]:

To Artifact [fd9c15d1e5]:


    31     31   #endif
    32     32   #ifdef HAVE_LIMITS_H
    33     33   #  include <limits.h>
    34     34   #endif
    35     35   #ifdef HAVE_STDIO_H
    36     36   #  include <stdio.h>
    37     37   #endif
           38  +#define HAVE_ERRNO_H 1
           39  +#ifdef HAVE_ERRNO_H
           40  +#  include <errno.h>
           41  +#endif
    38     42   #ifdef HAVE_ZLIB_H
    39     43   #  ifdef HAVE_LIBZ
    40     44   #    include <zlib.h>
    41     45   #  endif
    42     46   #else
    43     47   #  ifdef HAVE_LIBZ
    44     48   #    undef HAVE_LIBZ
................................................................................
  4389   4393   		} else {
  4390   4394   			
  4391   4395   		}
  4392   4396   	}
  4393   4397   
  4394   4398   	/* Determine list of readers */
  4395   4399   	pcsc_connect_ret = cackey_pcsc_connect();
         4400  +/* XXX: CAN HANG HERE ! */
  4396   4401   	if (pcsc_connect_ret != CACKEY_PCSC_S_OK) {
  4397   4402   		CACKEY_DEBUG_PRINTF("Connection to PC/SC failed, assuming no slots");
  4398   4403   
  4399   4404   		slot_count = 0;
  4400   4405   	} else {
  4401   4406   		pcsc_readers_len = 0;
  4402   4407   
................................................................................
  5305   5310   
  5306   5311   		fgets_ret = fgets(pinbuf, sizeof(pinbuf), pinfd);
  5307   5312   		if (fgets_ret == NULL) {
  5308   5313   			pinbuf[0] = '\0';
  5309   5314   		}
  5310   5315   
  5311   5316   		pclose_ret = pclose(pinfd);
         5317  +		if (pclose_ret == -1 && errno == ECHILD) {
         5318  +			CACKEY_DEBUG_PRINTF("Notice.  pclose() indicated it could not get the status of the child, assuming it succeeeded !");
         5319  +
         5320  +			pclose_ret = 0;
         5321  +		}
         5322  +
  5312   5323   		if (pclose_ret != 0) {
  5313   5324   			CACKEY_DEBUG_PRINTF("Error.  %s: exited with non-zero status of %i", pincmd, pclose_ret);
  5314   5325   
  5315   5326   			if (lock_mutex) {
  5316   5327   				cackey_mutex_unlock(cackey_biglock);
  5317   5328   			}
  5318   5329