mirror of git://git.gnupg.org/gnupg.git
agent,dirmngr: Handle corner case in shutdown mode.
* agent/gpg-agent.c (handle_connections): Keep on selecting on the inotify fd even when a shutdown is pending. * dirmngr/dirmngr.c (handle_connections): Ditto. Also simplifyy the use of the HAVE_INOTIFY_INIT cpp conditional. -- Without that patch we won't notice a removed socket when a shutdown is pending. This is somewhat related to bug report 2849. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
8489b12211
commit
854adc8ae1
|
@ -2831,6 +2831,12 @@ handle_connections (gnupg_fd_t listen_fd,
|
||||||
/* Do not accept new connections but keep on running the
|
/* Do not accept new connections but keep on running the
|
||||||
loop to cope with the timer events. */
|
loop to cope with the timer events. */
|
||||||
FD_ZERO (&fdset);
|
FD_ZERO (&fdset);
|
||||||
|
nfd = -1;
|
||||||
|
if (my_inotify_fd != -1)
|
||||||
|
{
|
||||||
|
FD_SET (my_inotify_fd, &fdset);
|
||||||
|
nfd = my_inotify_fd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* POSIX says that fd_set should be implemented as a structure,
|
/* POSIX says that fd_set should be implemented as a structure,
|
||||||
|
|
|
@ -1942,9 +1942,7 @@ handle_connections (assuan_fd_t listen_fd)
|
||||||
struct timespec curtime;
|
struct timespec curtime;
|
||||||
struct timespec timeout;
|
struct timespec timeout;
|
||||||
int saved_errno;
|
int saved_errno;
|
||||||
#ifdef HAVE_INOTIFY_INIT
|
int my_inotify_fd = -1;
|
||||||
int my_inotify_fd;
|
|
||||||
#endif /*HAVE_INOTIFY_INIT*/
|
|
||||||
|
|
||||||
npth_attr_init (&tattr);
|
npth_attr_init (&tattr);
|
||||||
npth_attr_setdetachstate (&tattr, NPTH_CREATE_DETACHED);
|
npth_attr_setdetachstate (&tattr, NPTH_CREATE_DETACHED);
|
||||||
|
@ -1988,14 +1986,12 @@ handle_connections (assuan_fd_t listen_fd)
|
||||||
FD_ZERO (&fdset);
|
FD_ZERO (&fdset);
|
||||||
FD_SET (FD2INT (listen_fd), &fdset);
|
FD_SET (FD2INT (listen_fd), &fdset);
|
||||||
nfd = FD2INT (listen_fd);
|
nfd = FD2INT (listen_fd);
|
||||||
#ifdef HAVE_INOTIFY_INIT
|
|
||||||
if (my_inotify_fd != -1)
|
if (my_inotify_fd != -1)
|
||||||
{
|
{
|
||||||
FD_SET (my_inotify_fd, &fdset);
|
FD_SET (my_inotify_fd, &fdset);
|
||||||
if (my_inotify_fd > nfd)
|
if (my_inotify_fd > nfd)
|
||||||
nfd = my_inotify_fd;
|
nfd = my_inotify_fd;
|
||||||
}
|
}
|
||||||
#endif /*HAVE_INOTIFY_INIT*/
|
|
||||||
|
|
||||||
npth_clock_gettime (&abstime);
|
npth_clock_gettime (&abstime);
|
||||||
abstime.tv_sec += TIMERTICK_INTERVAL;
|
abstime.tv_sec += TIMERTICK_INTERVAL;
|
||||||
|
@ -2012,6 +2008,12 @@ handle_connections (assuan_fd_t listen_fd)
|
||||||
/* Do not accept new connections but keep on running the
|
/* Do not accept new connections but keep on running the
|
||||||
loop to cope with the timer events. */
|
loop to cope with the timer events. */
|
||||||
FD_ZERO (&fdset);
|
FD_ZERO (&fdset);
|
||||||
|
nfd = -1;
|
||||||
|
if (my_inotify_fd != -1)
|
||||||
|
{
|
||||||
|
FD_SET (my_inotify_fd, &fdset);
|
||||||
|
nfd = my_inotify_fd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Take a copy of the fdset. */
|
/* Take a copy of the fdset. */
|
||||||
|
|
Loading…
Reference in New Issue