[libusb] Revert atexit patch (rhbz#1003193)

Hans de Goede jwrdegoede at fedoraproject.org
Thu Feb 13 16:40:50 UTC 2014


commit 83a6cee7e3f4d92ea858daf6c7f8c47ec79a45a0
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Feb 13 17:41:27 2014 +0100

    Revert atexit patch (rhbz#1003193)

 0002-Revert-use-atexit-to-call-libusb_exit.patch |   55 ++++++++++++++++++++++
 libusb.spec                                      |    7 ++-
 2 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/0002-Revert-use-atexit-to-call-libusb_exit.patch b/0002-Revert-use-atexit-to-call-libusb_exit.patch
new file mode 100644
index 0000000..65a2b1b
--- /dev/null
+++ b/0002-Revert-use-atexit-to-call-libusb_exit.patch
@@ -0,0 +1,55 @@
+From eb590b4dac00a5188b93e1d6ebdd60b06f9ab3d7 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at 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 at 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
+
diff --git a/libusb.spec b/libusb.spec
index 3ed2f47..aed0719 100644
--- a/libusb.spec
+++ b/libusb.spec
@@ -1,7 +1,7 @@
 Name: libusb
 Epoch: 1
 Version: 0.1.5
-Release: 2%{?dist}
+Release: 3%{?dist}
 Summary: A library which allows userspace access to USB devices
 Group: System Environment/Libraries
 License: LGPLv2+
@@ -9,6 +9,7 @@ URL: http://sourceforge.net/projects/libusb/
 Source0: http://downloads.sourceforge.net/libusb/libusb-compat-%{version}.tar.bz2
 Patch0: libusb-config-multilib.patch
 Patch1: 0001-Link-with-znodelete-to-disallow-unloading.patch
+Patch2: 0002-Revert-use-atexit-to-call-libusb_exit.patch
 BuildRequires: libusb1-devel
 
 %description
@@ -33,6 +34,7 @@ libusb-1.0 library instead of this one.
 %setup -q -n libusb-compat-%{version}
 %patch0 -p1 -b .config-multilib
 %patch1 -p1
+%patch2 -p1
 
 
 %build
@@ -61,6 +63,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/libusb.la
 
 
 %changelog
+* Thu Feb 13 2014 Hans de Goede <hdegoede at redhat.com> - 0.1.5-3
+- Revert atexit patch (rhbz#1003193)
+
 * Wed Aug 14 2013 Hans de Goede <hdegoede at redhat.com> - 0.1.5-2
 - Link with -znodelete to fix crash on unload of dl-opened code (rhbz#996760)
 


More information about the scm-commits mailing list