diff options
author | Matthias Bolte <matthias.bolte@googlemail.com> | 2013-10-01 14:10:48 +0200 |
---|---|---|
committer | Pete Batard <pete@akeo.ie> | 2013-10-01 23:59:42 +0100 |
commit | a9cd54f24d566062a461d27f615365f41a3d11e8 (patch) | |
tree | 4aba35ef8504cc2a2880e9406d87fcddc7e437ae | |
parent | 16692c825e6f55548b28738dcf2f9b6157b9daf1 (diff) | |
download | libusb-a9cd54f24d566062a461d27f615365f41a3d11e8.tar.gz |
Windows: Avoid potential mismatch in transfer error reporting
The default case in windows_transfer_callback() calls windows_error_str(0)
which will convert the error code returned by GetLastError() to a string.
This currently works because windows_transfer_callback() is either called
with io_result set to NO_ERROR or io_result set to GetLastError().
If windows_transfer_callback() will ever be called with io_result set
differently then the default case might report the wrong error message.
Call windows_error_str(io_result) instead to avoid this.
Closes #151
-rw-r--r-- | libusb/os/windows_usb.c | 2 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index fdc60c7..4493088 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -2078,7 +2078,7 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t } break; default: - usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error %d: %s", io_result, windows_error_str(0)); + usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error %d: %s", io_result, windows_error_str(io_result)); status = LIBUSB_TRANSFER_ERROR; break; } diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 7d39e3e..d3d70cf 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10844 +#define LIBUSB_NANO 10845 |