diff options
author | NIIBE Yutaka <[email protected]> | 2023-09-04 01:34:42 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-09-04 01:34:42 +0000 |
commit | 28364affa64ef9b3734b7af67062f96cca62a062 (patch) | |
tree | 4143112b8f8662404d04c030158be4913718bb2d | |
parent | agent: Fix timer list management. (diff) | |
download | gnupg-28364affa64ef9b3734b7af67062f96cca62a062.tar.gz gnupg-28364affa64ef9b3734b7af67062f96cca62a062.zip |
agent: Fix sock_inotify_fd handling.
* agent/gpg-agent.c (handle_connections): Also check SOCK_INOTIFY_FD
when spawning check_onw_socket_thread. When removal of the socket
is detected, do same as AGENT_PROBLEM_SOCKET_TAKEOVER.
--
GnuPG-bug-id: 6692
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | agent/gpg-agent.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 8c7f08c22..b7863cbbe 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -3055,7 +3055,7 @@ handle_connections (gnupg_fd_t listen_fd, have_homedir_inotify = 1; #if CHECK_OWN_SOCKET_INTERVAL > 0 - if (!disable_check_own_socket) + if (!disable_check_own_socket && sock_inotify_fd == -1) { npth_t thread; @@ -3255,7 +3255,10 @@ handle_connections (gnupg_fd_t listen_fd, && FD_ISSET (sock_inotify_fd, &read_fdset) && gnupg_inotify_has_name (sock_inotify_fd, GPG_AGENT_SOCK_NAME)) { - shutdown_pending = 1; + /* We may not remove the socket (if any), as it may be now + in use by another server. */ + inhibit_socket_removal = 1; + shutdown_pending = 2; close (sock_inotify_fd); sock_inotify_fd = -1; log_info ("socket file has been removed - shutting down\n"); |