Blob Blame Raw
From eb590b4dac00a5188b93e1d6ebdd60b06f9ab3d7 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 13 Feb 2014 17:25:27 +0100
Subject: [libusb-compat PATCH 2/2] Revert "use atexit() to call libusb_exit()"

The use of atexit() breaks various users of libusb-compat,
see ie: https://bugzilla.redhat.com/show_bug.cgi?id=1003193

This reverts commit 0be16b8dd25733d242ae32b57823a9513ec21353.

Closes libusbx/libusb-compat-0.1#2

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 libusb/core.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/libusb/core.c b/libusb/core.c
index c0ccb1f..2dd1b5f 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -21,7 +21,6 @@
 #include <config.h>
 #include <errno.h>
 #include <stdarg.h>
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -137,13 +136,6 @@ static void usbi_log(enum usbi_log_level level, const char *function,
 	fprintf(stream, "\n");
 }
 
-static void _usb_finalize(void) {
-       if (ctx) {
-          libusb_exit(ctx);
-               ctx = NULL;
-               }
-}
-
 API_EXPORTED void usb_init(void)
 {
 	int r;
@@ -159,8 +151,6 @@ API_EXPORTED void usb_init(void)
 		/* usb_set_debug can be called before usb_init */
 		if (usb_debug)
 			libusb_set_debug(ctx, 3);
-
-               atexit(_usb_finalize);
 	}
 }
 
-- 
1.8.5.3