You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gutenprint/SOURCES/gutenprint-libusb-crash.patch

76 lines
2.4 KiB

diff --git a/src/cups/backend_common.c b/src/cups/backend_common.c
index 6333408..b19668d 100644
--- a/src/cups/backend_common.c
+++ b/src/cups/backend_common.c
@@ -753,8 +753,7 @@ static struct dyesub_backend *backends[] = {
NULL,
};
-static int find_and_enumerate(struct libusb_context *ctx,
- struct libusb_device ***list,
+static int find_and_enumerate(struct libusb_device ***list,
const struct dyesub_backend *backend,
const char *match_serno,
const char *make,
@@ -777,7 +776,7 @@ static int find_and_enumerate(struct libusb_context *ctx,
STATE("+org.gutenprint.searching-for-device\n");
/* Enumerate and find suitable device */
- num = libusb_get_device_list(ctx, list);
+ num = libusb_get_device_list(NULL, list);
/* See if we can actually match on the supplied make! */
if (backend && make) {
@@ -1010,7 +1009,6 @@ along with this program; if not, see <https://www.gnu.org/licenses/>.\n\n";
void print_help(const char *argv0, const struct dyesub_backend *backend)
{
- struct libusb_context *ctx = NULL;
struct libusb_device **list = NULL;
const char *ptr = getenv("BACKEND");
@@ -1072,7 +1070,7 @@ void print_help(const char *argv0, const struct dyesub_backend *backend)
}
/* Scan for all printers for the specified backend */
- find_and_enumerate(ctx, &list, backend, NULL, ptr, 1, 1, NULL);
+ find_and_enumerate(&list, backend, NULL, ptr, 1, 1, NULL);
libusb_free_device_list(list, 1);
}
@@ -1251,7 +1249,6 @@ done:
int main (int argc, char **argv)
{
- struct libusb_context *ctx = NULL;
struct libusb_device **list = NULL;
struct dyesub_backend *backend = NULL;
@@ -1414,7 +1411,7 @@ int main (int argc, char **argv)
#endif
/* Libusb setup */
- ret = libusb_init(&ctx);
+ ret = libusb_init(NULL);
if (ret) {
ERROR("Failed to initialize libusb (%d)\n", ret);
ret = CUPS_BACKEND_RETRY_CURRENT;
@@ -1438,7 +1435,7 @@ int main (int argc, char **argv)
}
/* Enumerate devices */
- found = find_and_enumerate(ctx, &list, backend, use_serno, backend_str, 0, NUM_CLAIM_ATTEMPTS, &conn);
+ found = find_and_enumerate(&list, backend, use_serno, backend_str, 0, NUM_CLAIM_ATTEMPTS, &conn);
if (found == -1) {
ERROR("Printer open failure (No matching printers found!)\n");
@@ -1572,7 +1569,7 @@ done:
if (list)
libusb_free_device_list(list, 1);
- libusb_exit(ctx);
+ libusb_exit(NULL);
return ret;
}