.gear/rules | 3 + .../tags/36c127c969614ef3c1c42e177fec876020d88998 | 13 ++ .../tags/8c4d1ef6343e877a0ff597451fd6e5b42ef680b8 | 13 ++ .gear/tags/list | 2 + libusb.spec | 164 ++++++++++++++++++++ libusb/os/linux_usbfs.c | 10 +- 6 files changed, 203 insertions(+), 2 deletions(-) diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..05ebff1 --- /dev/null +++ b/.gear/rules @@ -0,0 +1,3 @@ +tar: v@version@:. +diff: v@version@:. @version@-@release@:. + diff --git a/.gear/tags/36c127c969614ef3c1c42e177fec876020d88998 b/.gear/tags/36c127c969614ef3c1c42e177fec876020d88998 new file mode 100644 index 0000000..bf7a240 --- /dev/null +++ b/.gear/tags/36c127c969614ef3c1c42e177fec876020d88998 @@ -0,0 +1,13 @@ +object e0365a6f22e0e7f330ac931df031cf6f17f453d1 +type commit +tag v1.0 +tagger Alexander Bokovoy 1238322143 +0300 + +Tag 1.0 release +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iEYEABECAAYFAknPS+UACgkQncWKdrYPwplQ8QCg3XuvA72IkIgwjI42vdYUcdjm +Av0AnRLvi0izvOP6Cm+kmn6jdKmeOBQ3 +=CEpw +-----END PGP SIGNATURE----- diff --git a/.gear/tags/8c4d1ef6343e877a0ff597451fd6e5b42ef680b8 b/.gear/tags/8c4d1ef6343e877a0ff597451fd6e5b42ef680b8 new file mode 100644 index 0000000..57a9193 --- /dev/null +++ b/.gear/tags/8c4d1ef6343e877a0ff597451fd6e5b42ef680b8 @@ -0,0 +1,13 @@ +object f0b7bdab077c16effef1a2555f5d5be3e1928cb5 +type commit +tag 1.0-alt2 +tagger Alexander Bokovoy 1238323535 +0300 + +libusb 1.0-alt2 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iEYEABECAAYFAknPUU8ACgkQncWKdrYPwpnpuQCgsL5mbtF9pHAJ7LplgmCPOJ42 +ymUAn024LMLE08qzNkhlaaCYh8iqrE+A +=Y0fv +-----END PGP SIGNATURE----- diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..88a0a5f --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1,2 @@ +8c4d1ef6343e877a0ff597451fd6e5b42ef680b8 1.0-alt2 +36c127c969614ef3c1c42e177fec876020d88998 v1.0 diff --git a/libusb.spec b/libusb.spec new file mode 100644 index 0000000..798bb57 --- /dev/null +++ b/libusb.spec @@ -0,0 +1,164 @@ +%def_enable static +%define cpplib libusbpp +Name: libusb +Version: 1.0 +Release: alt2 + +Summary: Libusb is a library which allows userspace access to USB devices +Summary(ru_RU.KOI8-R): 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 linux-libc-headers pkg-config + +%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/%_libdir/pkgconfig + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%_libdir/%{name}*.so.* +%doc COPYING AUTHORS README NEWS PORTING THANKS TODO + +%files devel +%_bindir/libusb-config +%_libdir/%{name}*.so +%_includedir/* +%_libdir/pkgconfig/%{name}* + +%if_enabled static +%files devel-static +%_libdir/%{name}*.a +%endif + +%files doc +%doc doc/html + +%changelog +* 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);