From 3926c0e4347766063906bdaf8022c77d3ad4ca94 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 20 Jul 2016 21:50:44 +0200 Subject: [PATCH] Two fixes - Add the previously omitted systemd service file (rh #1352055) - Fix crash with invalid arguments (rh #1358472) --- 0001-Fix-crash-on-early-fail.patch | 29 +++++++++++++++++++++++++++++ usb_modeswitch.spec | 27 +++++++++++++++------------ 2 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 0001-Fix-crash-on-early-fail.patch diff --git a/0001-Fix-crash-on-early-fail.patch b/0001-Fix-crash-on-early-fail.patch new file mode 100644 index 0000000..bab74dc --- /dev/null +++ b/0001-Fix-crash-on-early-fail.patch @@ -0,0 +1,29 @@ +From 73001792b29f080fcabc57f30d6030bedb2a24b0 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Wed, 20 Jul 2016 21:14:10 +0200 +Subject: [PATCH] Fix crash on early fail + +Don't uninitialize libusb if it has not been initialized yet. + +https://bugzilla.redhat.com/show_bug.cgi?id=1358472 +--- + usb_modeswitch.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/usb_modeswitch.c b/usb_modeswitch.c +index cbb8c28..f9c8b2e 100644 +--- a/usb_modeswitch.c ++++ b/usb_modeswitch.c +@@ -2021,7 +2021,8 @@ void close_all() + libusb_close(devh); + // libusb_exit will crash on Raspbian 7, crude protection + #ifndef __ARMEL__ +- libusb_exit(NULL); ++ if (ctx) ++ libusb_exit(NULL); + #endif + if (sysmode) + closelog(); +-- +2.7.4 + diff --git a/usb_modeswitch.spec b/usb_modeswitch.spec index 12cdd86..4ebd909 100644 --- a/usb_modeswitch.spec +++ b/usb_modeswitch.spec @@ -2,7 +2,7 @@ Name: usb_modeswitch Version: 2.4.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: USB Modeswitch gets mobile broadband cards in operational mode Summary(de): USB Modeswitch aktiviert UMTS-Karten Group: Applications/System @@ -16,11 +16,14 @@ Source1: http://www.draisberghof.de/usb_modeswitch/device_reference.txt Patch0: rhbz948451-fix-manual-pages.patch # Submitted upstream (2014-11-24) Patch1: device_reference-utf8.patch +# http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2556 +Patch2: 0001-Fix-crash-on-early-fail.patch BuildRequires: libusbx-devel BuildRequires: jimtcl-devel BuildRequires: systemd-devel Requires: usb_modeswitch-data >= 20121109 +Requires: systemd %description USB Modeswitch brings up your datacard into operational mode. When plugged @@ -42,6 +45,7 @@ cp -f %{SOURCE1} device_reference.txt %patch0 -p1 -b .manpage %patch1 -p0 -b .utf8 +%patch2 -p1 -b .libusb_exit %build @@ -49,17 +53,11 @@ CFLAGS="$RPM_OPT_FLAGS" make %{?_smp_mflags} %install -mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/udev -mkdir -p $RPM_BUILD_ROOT%{_sbindir} -mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} - -install -p -m 755 usb_modeswitch $RPM_BUILD_ROOT%{_sbindir}/ -install -p -m 755 usb_modeswitch_dispatcher $RPM_BUILD_ROOT%{_sbindir}/usb_modeswitch_dispatcher -install -p -m 644 usb_modeswitch.conf $RPM_BUILD_ROOT%{_sysconfdir}/ -gzip -9c usb_modeswitch.1 > usb_modeswitch.1.gz && install -m 644 usb_modeswitch.1.gz $RPM_BUILD_ROOT%{_datadir}/man/man1 -gzip -9c usb_modeswitch_dispatcher.1 > usb_modeswitch_dispatcher.1.gz && install -m 644 usb_modeswitch_dispatcher.1.gz $RPM_BUILD_ROOT%{_datadir}/man/man1 -install -p -m 755 usb_modeswitch.sh $RPM_BUILD_ROOT%{_prefix}/lib/udev/usb_modeswitch +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +make install \ + DESTDIR=$RPM_BUILD_ROOT \ + SYSDIR=$RPM_BUILD_ROOT%{_unitdir} \ + UDEVDIR=$RPM_BUILD_ROOT%{_prefix}/lib/udev %files @@ -68,11 +66,16 @@ install -p -m 755 usb_modeswitch.sh $RPM_BUILD_ROOT%{_prefix}/lib/udev/usb_modes %{_mandir}/man1/usb_modeswitch.1.gz %{_mandir}/man1/usb_modeswitch_dispatcher.1.gz %{_prefix}/lib/udev/usb_modeswitch +%{_unitdir}/usb_modeswitch@.service %config(noreplace) %{_sysconfdir}/usb_modeswitch.conf %doc COPYING README ChangeLog device_reference.txt %changelog +* Wed Jul 20 2016 Lubomir Rintel - 2.4.0-2 +- Add the previously omitted systemd service file (rh #1352055) +- Fix crash with invalid arguments (rh #1358472) + * Wed Jun 22 2016 Lubomir Rintel - 2.4.0-1 - New 2.4.0 release