kopia lustrzana https://gitlab.com/sane-project/backends
Close network fds in the Avahi process
Network fds are of no use to the Avahi process and can cause the net backend to hang when saned is run in debug mode. This only happens if the net backend tries to connect to saned a second time and manages to establish the connection before saned has completed its shutdown. There is some potential for this to also occur when saned is run in standalone mode but it's far less probable as the window is a lot smaller.merge-requests/1/head
rodzic
79e6e5c420
commit
d92a20febb
|
@ -1,6 +1,9 @@
|
|||
2009-05-06 Julien Blache <jb@jblache.org>
|
||||
* tools/sane-desc.c: unbreak udev rules, use ATTRS instead of ATTR
|
||||
for USB devices.
|
||||
* frontend/saned.c: pass the network fds to saned_avahi() so the
|
||||
Avahi process can close them. Fixes a hang possible hang of the
|
||||
net backend when saned is run in debug mode.
|
||||
|
||||
2009-05-05 Julien Blache <jb@jblache.org>
|
||||
* doc/backend-writing.txt, doc/releases.txt: update for the switch
|
||||
|
|
|
@ -2338,7 +2338,7 @@ sig_int_term_handler (int signum)
|
|||
|
||||
#ifdef WITH_AVAHI
|
||||
static void
|
||||
saned_avahi (void);
|
||||
saned_avahi (struct pollfd *fds, int nfds);
|
||||
|
||||
static void
|
||||
saned_create_avahi_services (AvahiClient *c);
|
||||
|
@ -2351,8 +2351,9 @@ saned_avahi_group_callback (AvahiEntryGroup *g, AvahiEntryGroupState state, void
|
|||
|
||||
|
||||
static void
|
||||
saned_avahi (void)
|
||||
saned_avahi (struct pollfd *fds, int nfds)
|
||||
{
|
||||
struct pollfd *fdp = NULL;
|
||||
int error;
|
||||
|
||||
avahi_pid = fork ();
|
||||
|
@ -2371,6 +2372,12 @@ saned_avahi (void)
|
|||
signal (SIGINT, NULL);
|
||||
signal (SIGTERM, NULL);
|
||||
|
||||
/* Close network fds */
|
||||
for (fdp = fds; nfds > 0; nfds--, fdp++)
|
||||
close (fdp->fd);
|
||||
|
||||
free(fds);
|
||||
|
||||
avahi_svc_name = avahi_strdup(SANED_NAME);
|
||||
|
||||
avahi_poll = avahi_simple_poll_new ();
|
||||
|
@ -3055,7 +3062,7 @@ run_standalone (int argc, char **argv)
|
|||
|
||||
#ifdef WITH_AVAHI
|
||||
DBG (DBG_INFO, "run_standalone: spawning Avahi process\n");
|
||||
saned_avahi ();
|
||||
saned_avahi (fds, nfds);
|
||||
#endif /* WITH_AVAHI */
|
||||
|
||||
DBG (DBG_MSG, "run_standalone: waiting for control connection\n");
|
||||
|
|
Ładowanie…
Reference in New Issue