ayaports/user/sane/sane-backends-no-avahi-thread.patch

48 lines
1.7 KiB
Diff

diff --git a/backend/net.c.orig b/backend/net.c
index 7c4aae9..0adfbc2 100644
--- a/backend/net.c.orig
+++ b/backend/net.c
@@ -1043,12 +1043,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
continue;
}
#if WITH_AVAHI
- avahi_threaded_poll_lock (avahi_thread);
+ if(avahi_thread) avahi_threaded_poll_lock (avahi_thread);
#endif /* WITH_AVAHI */
DBG (2, "sane_init: trying to add %s\n", device_name);
add_device (device_name, 0);
#if WITH_AVAHI
- avahi_threaded_poll_unlock (avahi_thread);
+ if(avahi_thread) avahi_threaded_poll_unlock (avahi_thread);
#endif /* WITH_AVAHI */
}
@@ -1094,12 +1094,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
continue;
#endif /* ENABLE_IPV6 */
#if WITH_AVAHI
- avahi_threaded_poll_lock (avahi_thread);
+ if(avahi_thread) avahi_threaded_poll_lock (avahi_thread);
#endif /* WITH_AVAHI */
DBG (2, "sane_init: trying to add %s\n", host);
add_device (host, 0);
#if WITH_AVAHI
- avahi_threaded_poll_unlock (avahi_thread);
+ if(avahi_thread) avahi_threaded_poll_unlock (avahi_thread);
#endif /* WITH_AVAHI */
}
free (copy);
@@ -1517,11 +1517,11 @@ sane_open (SANE_String_Const full_name, SANE_Handle * meta_handle)
"sane_open: device %s not found, trying to register it anyway\n",
nd_name);
#if WITH_AVAHI
- avahi_threaded_poll_lock (avahi_thread);
+ if(avahi_thread) avahi_threaded_poll_lock (avahi_thread);
#endif /* WITH_AVAHI */
status = add_device (nd_name, &dev);
#if WITH_AVAHI
- avahi_threaded_poll_unlock (avahi_thread);
+ if(avahi_thread) avahi_threaded_poll_unlock (avahi_thread);
#endif /* WITH_AVAHI */
if (status != SANE_STATUS_GOOD)
{