.gear/rules | 3 + .../tags/85b235687c3d2029b097d3c8340bbefde1002ae1 | 13 ++ .gear/tags/list | 1 + libusb.spec | 173 ++++++++++++++++++++ libusb/os/linux_usbfs.c | 10 +- 5 files changed, 198 insertions(+), 2 deletions(-) diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..274d7d6 --- /dev/null +++ b/.gear/rules @@ -0,0 +1,3 @@ +tar: v@version@:. +diff: v@version@:. . + diff --git a/.gear/tags/85b235687c3d2029b097d3c8340bbefde1002ae1 b/.gear/tags/85b235687c3d2029b097d3c8340bbefde1002ae1 new file mode 100644 index 0000000..fa01b3a --- /dev/null +++ b/.gear/tags/85b235687c3d2029b097d3c8340bbefde1002ae1 @@ -0,0 +1,13 @@ +object 068ff5b8a83fec0a9a91c80535a25b89a9ae64e8 +type commit +tag v1.0.1 +tagger Alexander Bokovoy 1242837555 +0300 + +Re-introduce v1.0.1 tag with signature (required by ALT Linux build system) +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iEYEABECAAYFAkoUMkcACgkQncWKdrYPwplt0gCguO9ntntUgn1Cen7tLkQYIPty +BvMAn0EZJkp2NW37uS7mg+NpHgnxiare +=flj+ +-----END PGP SIGNATURE----- diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..1270bb3 --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +85b235687c3d2029b097d3c8340bbefde1002ae1 v1.0.1 diff --git a/libusb.spec b/libusb.spec new file mode 100644 index 0000000..ca48611 --- /dev/null +++ b/libusb.spec @@ -0,0 +1,173 @@ +%def_enable static +%define cpplib libusbpp +Name: libusb +Version: 1.0.1 +Release: alt1 + +Summary: Libusb is a library which allows userspace access to USB devices +Summary(ru_RU.UTF-8): Libusb - это библиотека, предоставляющая приложениям доступ к USB устройствам +License: LGPL +Group: System/Libraries +Url: http://sourceforge.net/projects/libusb/ +Packager: Alexander Bokovoy + +%define namecompat %name-compat-0.1.0 + +Source0: %name-%version.tar +Patch0: %name-%version-%release.patch + +BuildPreReq: docbook-dtds docbook-style-dsssl docbook-utils doxygen graphviz openjade sgml-common gcc-c++ + +BuildRequires: docbook-utils doxygen gcc-c++ graphviz + +%description +Libusb is a library which allows userspace access to USB devices + +%package devel +Summary: Libusb is a library which allows userspace access to USB devices +Group: Development/C +Requires: %name = %version-%release + +%description devel +Libusb is a library which allows userspace access to USB devices + +This package contains header files needed for the development of programs that +use libusb. + +%if_enabled static +%package devel-static +Summary: Libusb is a library which allows userspace access to USB devices +Group: Development/C +Requires: %name-devel = %version-%release + +%description devel-static +Libusb is a library which allows userspace access to USB devices + +This package provides static libraries to use libusb. +%endif + +%package doc +Summary: Libusb is a library which allows userspace access to USB devices +Group: Development/C +Requires: %name = %version-%release + +%description doc +This package contains documentation for %name. + +%prep +%setup -q +%patch -p1 + +%build +aclocal +%autoreconf +%configure %{subst_enable static} +%make_build +%make -C doc docs + +%install +%makeinstall pkgconfigdir=%buildroot%_pkgconfigdir + +mkdir %buildroot/%_lib +mv %buildroot%_libdir/%name-*.so.* %buildroot/%_lib/ +ln -sf ../../%_lib/%name-1.0.so.0.0.0 %buildroot%_libdir/%name-1.0.so + +%files +/%_lib/%name-*.so.* +%doc COPYING AUTHORS README NEWS PORTING THANKS TODO + +%files devel +%_libdir/%name-*.so +%_includedir/* +%_pkgconfigdir/%name-*.pc + +%if_enabled static +%files devel-static +%_libdir/%name-*.a +%endif + +%files doc +%doc doc/html + +%changelog +* Wed May 20 2009 Alexander Bokovoy 1.0.1-alt1 +- 1.0.1 +- Include fixes from git.alt:/people/shrek/packages/libusb.git of 1.0-alt3 +- libusb-1.0.so.* library now is in /lib. +- Compatibility library is left in secondary system library path + +* Wed May 20 2009 Valery Inozemtsev 1.0-alt3 +- relocate libusb-1.0.so.* to /lib + +* Sun Mar 29 2009 Alexander Bokovoy 1.0-alt2 +- 1.0 +- Include ALT-specific fixes + +* Sat Nov 22 2008 Alexander Bokovoy 0.9.4-alt2.0 +- Fixed: + + Memory leaks in processing active configuration descriptors + +* Sat Nov 22 2008 Alexander Bokovoy 0.9.4-alt1.0 +- Update to 0.9.4 and libusb-compat-0.1-beta3 + +* Wed Oct 01 2008 Alexander Bokovoy 0.9.3-alt3.0 +- Fixed: + + Work around bad code in KDE that attempts to close non-opened USB devices for now + + Issue a warning about a frivolous use of usb_close(NULL) at application level which + was tolerated by libusb 0.1. Should fix #17352 + +* Thu Sep 18 2008 Alexander Bokovoy 0.9.3-alt2.0 +- Add x86_64 support + +* Sun Sep 14 2008 Alexander Bokovoy 0.9.3-alt1.0 +- New version +- Package libusb-compat-0.1 to keep compatibility with old code + +* Mon Apr 16 2007 ALT QA Team Robot 0.1.12-alt1.0 +- Automated rebuild. + +* Fri Apr 28 2006 Anton Farygin 0.1.12-alt1 +- new version + +* Tue Sep 13 2005 Anton Farygin 0.1.10a-alt3 +- enabled devel-static packages + +* Thu Sep 08 2005 Anton Farygin 0.1.10a-alt2 +- new version, with specfile from wrar@ (#7580, #7579) + +* Sat Aug 06 2005 Andrey Rahmatullin 0.1.10a-alt1 +- 0.1.10a +- removed outdated docs, packaged bundled docs (#7580) + +* Mon Apr 26 2004 Anton Farygin 0.1.8-alt1 +- 0.1.8 + +* Sun Dec 14 2003 Rider 0.1.7-alt2 +- removed .la files + +* Mon Jan 06 2003 Rider 0.1.7-alt1 +- 0.1.7 +- added build requires + +* Mon Sep 16 2002 Rider 0.1.6a-alt2 +- gcc 3.2 rebuild + +* Sat Aug 24 2002 Rider 0.1.6a-alt1 +- 0.1.6a + +* Sun Feb 10 2002 Rider 0.1.5-alt1 +- 0.1.5 + +* Thu Dec 06 2001 Konstantin Volckov 0.1.4-alt1 +- 0.1.4 +- Added documentation + +* Fri Aug 24 2001 Konstantin Volckov 0.1.3b-alt2 +- Fixed requires +- Added devel-static package + +* Fri Aug 24 2001 Rider 0.1.3b-alt1 +- First build for ALT + +* Thu Mar 1 2001 Frederic Crozat 0.1.3b-1mdk +- Initial Mandrake release diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index 7727ba6..9401e2d 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -390,9 +390,11 @@ static int sysfs_get_active_config_descriptor(struct libusb_device *dev, if (r < 0) { usbi_err(DEVICE_CTX(dev), "read failed, ret=%d errno=%d", fd, errno); + close(fd); return LIBUSB_ERROR_IO; } else if (r < sizeof(tmp)) { usbi_err(DEVICE_CTX(dev), "short read %d/%d", r, sizeof(tmp)); + close(fd); return LIBUSB_ERROR_IO; } @@ -402,12 +404,16 @@ static int sysfs_get_active_config_descriptor(struct libusb_device *dev, /* try the next descriptor */ off = lseek(fd, 0 - sizeof(tmp), SEEK_CUR); - if (off < 0) + if (off < 0) { + close(fd); return LIBUSB_ERROR_IO; + } r = seek_to_next_config(DEVICE_CTX(dev), fd); - if (r < 0) + if (r < 0) { + close(fd); return r; + } } to_copy = (len < sizeof(tmp)) ? len : sizeof(tmp);