#include <signal.h>
#include <pthread.h>
#include <errno.h>
+#include <inttypes.h>
#include "usb-driver.h"
static int (*ioctl_func) (int, int, void *) = NULL;
static pthread_mutex_t int_wait = PTHREAD_MUTEX_INITIALIZER;
#define NO_WINDRVR 1
-#undef DEBUG
+/* #define DEBUG 1 */
#ifdef DEBUG
#define DPRINTF(format, args...) fprintf(stderr, format, ##args)
if (!func)
func = (int (*) (int)) dlsym(RTLD_NEXT, "close");
- if (fd == windrvrfd) {
+ if (fd == windrvrfd && windrvrfd >= 0) {
DPRINTF("close windrvrfd\n");
windrvrfd = -1;
}