1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

agent,kbx: Fix reliable_homedir_inotify (2/2).

* agent/gpg-agent.c (main): The value of reliable_homedir_inotify
doesn't not related to nodetach, and it's only zero in the specific
condition.
* kbx/keyboxd.c (handle_connections): Remove the last argument.
(main): Remove reliable_homedir_inotify, as it's always one.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-12-26 11:58:43 +09:00
parent c44f0bc91e
commit 7cde533ce8
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
2 changed files with 12 additions and 22 deletions

View File

@ -1093,7 +1093,7 @@ main (int argc, char **argv)
int gpgconf_list = 0; int gpgconf_list = 0;
gpg_error_t err; gpg_error_t err;
struct assuan_malloc_hooks malloc_hooks; struct assuan_malloc_hooks malloc_hooks;
int reliable_homedir_inotify = 0; int reliable_homedir_inotify = 1;
early_system_init (); early_system_init ();
@ -1819,14 +1819,14 @@ main (int argc, char **argv)
log_get_prefix (&oldflags); log_get_prefix (&oldflags);
log_set_prefix (NULL, oldflags | GPGRT_LOG_RUN_DETACHED); log_set_prefix (NULL, oldflags | GPGRT_LOG_RUN_DETACHED);
opt.running_detached = 1; opt.running_detached = 1;
/* Unless we are running with a program given on the command
* line we can assume that the inotify things works and thus
* we can avoid the regular stat calls. */
if (!argc)
reliable_homedir_inotify = 1;
} }
/* When we are running with a program given on the command
* line, the inotify things may not work well and thus
* we cannot avoid the regular stat calls. */
if (argc)
reliable_homedir_inotify = 0;
{ {
struct sigaction sa; struct sigaction sa;

View File

@ -249,8 +249,7 @@ static void kbxd_libgcrypt_progress_cb (void *data, const char *what,
static void kbxd_init_default_ctrl (ctrl_t ctrl); static void kbxd_init_default_ctrl (ctrl_t ctrl);
static void kbxd_deinit_default_ctrl (ctrl_t ctrl); static void kbxd_deinit_default_ctrl (ctrl_t ctrl);
static void handle_connections (gnupg_fd_t listen_fd, static void handle_connections (gnupg_fd_t listen_fd);
int reliable_homedir_inotify);
static void check_own_socket (void); static void check_own_socket (void);
static int check_for_running_kbxd (int silent); static int check_for_running_kbxd (int silent);
@ -460,8 +459,6 @@ main (int argc, char **argv )
int gpgconf_list = 0; int gpgconf_list = 0;
int debug_wait = 0; int debug_wait = 0;
struct assuan_malloc_hooks malloc_hooks; struct assuan_malloc_hooks malloc_hooks;
int reliable_homedir_inotify = 0;
early_system_init (); early_system_init ();
@ -802,11 +799,6 @@ main (int argc, char **argv )
log_get_prefix (&oldflags); log_get_prefix (&oldflags);
log_set_prefix (NULL, oldflags | GPGRT_LOG_RUN_DETACHED); log_set_prefix (NULL, oldflags | GPGRT_LOG_RUN_DETACHED);
opt.running_detached = 1; opt.running_detached = 1;
/* Because we don't support running a program on the command
* line we can assume that the inotify things works and thus
* we can avoid the regular stat calls. */
reliable_homedir_inotify = 1;
} }
{ {
@ -844,7 +836,7 @@ main (int argc, char **argv )
} }
log_info ("%s %s started\n", gpgrt_strusage(11), gpgrt_strusage(13)); log_info ("%s %s started\n", gpgrt_strusage(11), gpgrt_strusage(13));
handle_connections (fd, reliable_homedir_inotify); handle_connections (fd);
assuan_sock_close (fd); assuan_sock_close (fd);
} }
@ -1446,7 +1438,7 @@ start_connection_thread (void *arg)
/* Connection handler loop. Wait for connection requests and spawn a /* Connection handler loop. Wait for connection requests and spawn a
* thread after accepting a connection. */ * thread after accepting a connection. */
static void static void
handle_connections (gnupg_fd_t listen_fd, int reliable_homedir_inotify) handle_connections (gnupg_fd_t listen_fd)
{ {
gpg_error_t err; gpg_error_t err;
npth_attr_t tattr; npth_attr_t tattr;
@ -1501,9 +1493,7 @@ handle_connections (gnupg_fd_t listen_fd, int reliable_homedir_inotify)
gpg_strerror (err)); gpg_strerror (err));
} }
if (!reliable_homedir_inotify) if ((err = gnupg_inotify_watch_delete_self (&home_inotify_fd,
home_inotify_fd = -1;
else if ((err = gnupg_inotify_watch_delete_self (&home_inotify_fd,
gnupg_homedir ()))) gnupg_homedir ())))
{ {
if (gpg_err_code (err) != GPG_ERR_NOT_SUPPORTED) if (gpg_err_code (err) != GPG_ERR_NOT_SUPPORTED)