From 274ebe5f53d270211ef585cd0d2600cc63e66849 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 18 Aug 2020 12:06:59 +0200 Subject: [PATCH] 0.99.14 - fixing 1867126 --- .gitignore | 1 + sane-airscan-exit.patch | 172 ---------------------------------------- sane-airscan.spec | 10 +-- sources | 2 +- 4 files changed, 7 insertions(+), 178 deletions(-) delete mode 100644 sane-airscan-exit.patch diff --git a/.gitignore b/.gitignore index 3fc1ba1..723c520 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /sane-airscan-0.99.11.tar.gz /sane-airscan-0.99.12.tar.gz /sane-airscan-0.99.13.tar.gz +/sane-airscan-0.99.14.tar.gz diff --git a/sane-airscan-exit.patch b/sane-airscan-exit.patch deleted file mode 100644 index 2a3e37b..0000000 --- a/sane-airscan-exit.patch +++ /dev/null @@ -1,172 +0,0 @@ -diff --git a/airscan-conf.c b/airscan-conf.c -index 401272c..e252551 100644 ---- a/airscan-conf.c -+++ b/airscan-conf.c -@@ -604,6 +604,8 @@ conf_device_list_free (void) - { - conf_device *list = conf.devices, *next; - -+ conf.devices = NULL; -+ - while (list != NULL) { - next = list->next; - mem_free((char*) list->name); -diff --git a/airscan-mdns.c b/airscan-mdns.c -index 7611fef..55cae5b 100644 ---- a/airscan-mdns.c -+++ b/airscan-mdns.c -@@ -891,6 +891,10 @@ mdns_init (void) - void - mdns_cleanup (void) - { -+ if (mdns_log == NULL) { -+ return; /* MDNS not initialized */ -+ } -+ - if (mdns_avahi_poll != NULL) { - mdns_avahi_browser_stop(); - mdns_avahi_client_stop(); -diff --git a/airscan-rand.c b/airscan-rand.c -index 036a16b..7d22d4a 100644 ---- a/airscan-rand.c -+++ b/airscan-rand.c -@@ -46,8 +46,10 @@ rand_init (void) - void - rand_cleanup (void) - { -- fclose(rand_fp); -- rand_fp = NULL; -+ if (rand_fp != NULL) { -+ fclose(rand_fp); -+ rand_fp = NULL; -+ } - } - - /* vim:ts=8:sw=4:et -diff --git a/airscan-trace.c b/airscan-trace.c -index a0f08a3..de0fd1f 100644 ---- a/airscan-trace.c -+++ b/airscan-trace.c -@@ -315,10 +315,10 @@ trace_http_query_hook (trace *t, http_query *q) - trace_message_headers_foreach_callback, t); - fprintf(t->log, "\n"); - -+ trace_dump_body(t, http_query_get_response_data(q)); -+ - mp_count = http_query_get_mp_response_count(q); -- if (mp_count == 0) { -- trace_dump_body(t, http_query_get_response_data(q)); -- } else { -+ if (mp_count != 0) { - int i; - - for (i = 0; i < mp_count; i ++) { -diff --git a/airscan-wsdd.c b/airscan-wsdd.c -index 549f46d..695f704 100644 ---- a/airscan-wsdd.c -+++ b/airscan-wsdd.c -@@ -1671,6 +1671,10 @@ wsdd_cleanup (void) - { - netif_addr *addr; - -+ if (wsdd_log == NULL) { -+ return; /* WSDD not initialized */ -+ } -+ - if (wsdd_netif_notifier != NULL) { - netif_notifier_free(wsdd_netif_notifier); - wsdd_netif_notifier = NULL; -@@ -1695,10 +1699,8 @@ wsdd_cleanup (void) - - log_assert(wsdd_log, ll_empty(&wsdd_finding_list)); - -- if (wsdd_log != NULL) { -- log_ctx_free(wsdd_log); -- wsdd_log = NULL; -- } -+ log_ctx_free(wsdd_log); -+ wsdd_log = NULL; - } - - /* vim:ts=8:sw=4:et -diff --git a/airscan-zeroconf.c b/airscan-zeroconf.c -index 2c14196..3b8c667 100644 ---- a/airscan-zeroconf.c -+++ b/airscan-zeroconf.c -@@ -1441,9 +1441,11 @@ zeroconf_init (void) - void - zeroconf_cleanup (void) - { -- log_ctx_free(zeroconf_log); -- zeroconf_log = NULL; -- pthread_cond_destroy(&zeroconf_initscan_cond); -+ if (zeroconf_log != NULL) { -+ log_ctx_free(zeroconf_log); -+ zeroconf_log = NULL; -+ pthread_cond_destroy(&zeroconf_initscan_cond); -+ } - } - - /* vim:ts=8:sw=4:et -diff --git a/airscan.c b/airscan.c -index 198a09e..c422048 100644 ---- a/airscan.c -+++ b/airscan.c -@@ -8,6 +8,11 @@ - - #include "airscan.h" - -+/* Forward declarations -+ */ -+static void -+sane_exit_internal (void); -+ - /* Static variables - */ - static const SANE_Device **sane_device_list; -@@ -60,7 +65,7 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback authorize) - } - - if (status != SANE_STATUS_GOOD) { -- sane_exit(); -+ sane_exit_internal(); - } - - /* Start airscan thread */ -@@ -75,10 +80,10 @@ sane_init (SANE_Int *version_code, SANE_Auth_Callback authorize) - return status; - } - --/* Exit the backend -+/* Exit the backend -- internal version - */ --void --sane_exit (void) -+static void -+sane_exit_internal (void) - { - log_debug(NULL, "sane_exit() called"); - -@@ -102,6 +107,22 @@ sane_exit (void) - log_cleanup(); /* Must be the last thing to do */ - } - -+/* Exit the backend -+ * -+ * It wraps sane_exit_internal(), which does the actual work. -+ * Without this wrapping, if sane_exit() is overridden by -+ * dynamic linking and sane_init() calls sane_exit() to -+ * cleanup after failed initialization, it leads to unpredictable -+ * results -+ * -+ * See #61 for details -+ */ -+void -+sane_exit (void) -+{ -+ sane_exit_internal(); -+} -+ - /* Get list of devices - */ - SANE_Status diff --git a/sane-airscan.spec b/sane-airscan.spec index a5a742b..d2f21b5 100644 --- a/sane-airscan.spec +++ b/sane-airscan.spec @@ -4,17 +4,14 @@ %global _hardened_build 1 Name: sane-airscan -Version: 0.99.13 -Release: 2%{?dist} +Version: 0.99.14 +Release: 1%{?dist} Summary: SANE backend for AirScan (eSCL) and WSD document scanners # the exception is defined in LICENSE, meant for SANE project in most cases License: GPLv2+ with exceptions URL: https://github.com/alexpevzner/sane-airscan Source: %{URL}/archive/%{version}/%{name}-%{version}.tar.gz -# crash wsdd_cleanup in mock - sane_exit from SANE libs was -# called instead of airscan internal one -Patch01: sane-airscan-exit.patch # needed for querying and getting mDNS messages from local network BuildRequires: avahi-devel @@ -84,6 +81,9 @@ mkdir -p %{buildroot}/ %changelog +* Mon Aug 17 2020 Zdenek Dohnal - 0.99.14-1 +- 0.99.14 - fixing 1867126 + * Thu Aug 13 2020 Zdenek Dohnal - 0.99.13-2 - 1867692 - airscan driver crashes in mock during wsdd_cleanup() diff --git a/sources b/sources index c7f9f44..440abec 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (sane-airscan-0.99.13.tar.gz) = 89c9188ce95eed2192c69192369337548c4e33d0ee0d95cfb20c88d2d4a7974c0c763a1dd5cb0951310e5c03e16b33afac1cd54885ae786d952131757a9cb095 +SHA512 (sane-airscan-0.99.14.tar.gz) = 6b3950529f4a35a0daf8ce050ede41e2f28b10707e67c785e74322d2b48548f8d260c90055cbfa6bf28d9353336ef9ac83f1d6e3815f2ae705b8f7c355f06a31