mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
scd: Fix how scdaemon pipe server finishes.
* scd/scdaemon.h (scd_command_handler): Fix the return type. * scd/command.c (scd_command_handler): Not return a value. * scd/scdaemon.c (pipe_server): Make it auto variable in main. (main): Use auto PIPE_SERVER variable. (start_connection_thread): When it's a pipe connection and it finishes, let the service shutdown. -- GnuPG-bug-id: 7151 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
c4e6b6aba2
commit
01fa318be0
@ -2475,9 +2475,8 @@ register_commands (assuan_context_t ctx)
|
|||||||
|
|
||||||
|
|
||||||
/* Startup the server. If FD is given as -1 this is simple pipe
|
/* Startup the server. If FD is given as -1 this is simple pipe
|
||||||
server, otherwise it is a regular server. Returns true if there
|
server, otherwise it is a regular server. */
|
||||||
are no more active asessions. */
|
void
|
||||||
int
|
|
||||||
scd_command_handler (ctrl_t ctrl, gnupg_fd_t fd)
|
scd_command_handler (ctrl_t ctrl, gnupg_fd_t fd)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
@ -2576,9 +2575,6 @@ scd_command_handler (ctrl_t ctrl, gnupg_fd_t fd)
|
|||||||
|
|
||||||
if (stopme)
|
if (stopme)
|
||||||
scd_exit (0);
|
scd_exit (0);
|
||||||
|
|
||||||
/* If there are no more sessions return true. */
|
|
||||||
return !session_list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,9 +249,6 @@ static int shutdown_pending;
|
|||||||
/* It is possible that we are currently running under setuid permissions */
|
/* It is possible that we are currently running under setuid permissions */
|
||||||
static int maybe_setuid = 1;
|
static int maybe_setuid = 1;
|
||||||
|
|
||||||
/* Flag telling whether we are running as a pipe server. */
|
|
||||||
static int pipe_server;
|
|
||||||
|
|
||||||
/* Name of the communication socket */
|
/* Name of the communication socket */
|
||||||
static char *socket_name;
|
static char *socket_name;
|
||||||
/* Name of the redirected socket or NULL. */
|
/* Name of the redirected socket or NULL. */
|
||||||
@ -457,6 +454,7 @@ main (int argc, char **argv )
|
|||||||
int greeting = 0;
|
int greeting = 0;
|
||||||
int nogreeting = 0;
|
int nogreeting = 0;
|
||||||
int multi_server = 0;
|
int multi_server = 0;
|
||||||
|
int pipe_server = 0;
|
||||||
int is_daemon = 0;
|
int is_daemon = 0;
|
||||||
int nodetach = 0;
|
int nodetach = 0;
|
||||||
int csh_style = 0;
|
int csh_style = 0;
|
||||||
@ -467,7 +465,6 @@ main (int argc, char **argv )
|
|||||||
int allow_coredump = 0;
|
int allow_coredump = 0;
|
||||||
struct assuan_malloc_hooks malloc_hooks;
|
struct assuan_malloc_hooks malloc_hooks;
|
||||||
int res;
|
int res;
|
||||||
npth_t pipecon_handler;
|
|
||||||
const char *application_priority = NULL;
|
const char *application_priority = NULL;
|
||||||
|
|
||||||
early_system_init ();
|
early_system_init ();
|
||||||
@ -763,6 +760,7 @@ main (int argc, char **argv )
|
|||||||
ctrl_t ctrl;
|
ctrl_t ctrl;
|
||||||
npth_attr_t tattr;
|
npth_attr_t tattr;
|
||||||
gnupg_fd_t fd = GNUPG_INVALID_FD;
|
gnupg_fd_t fd = GNUPG_INVALID_FD;
|
||||||
|
npth_t pipecon_handler;
|
||||||
|
|
||||||
#ifndef HAVE_W32_SYSTEM
|
#ifndef HAVE_W32_SYSTEM
|
||||||
{
|
{
|
||||||
@ -1218,12 +1216,11 @@ start_connection_thread (void *arg)
|
|||||||
log_info (_("handler for fd %d started\n"),
|
log_info (_("handler for fd %d started\n"),
|
||||||
FD_DBG (ctrl->thread_startup.fd));
|
FD_DBG (ctrl->thread_startup.fd));
|
||||||
|
|
||||||
/* If this is a pipe server, we request a shutdown if the command
|
/* If this thread is the pipe connection thread, flag that a
|
||||||
handler asked for it. With the next ticker event and given that
|
shutdown is required. With the next ticker event and given that
|
||||||
no other connections are running the shutdown will then
|
no other connections are running the shutdown will then
|
||||||
happen. */
|
happen. */
|
||||||
if (scd_command_handler (ctrl, ctrl->thread_startup.fd)
|
if (ctrl->thread_startup.fd == GNUPG_INVALID_FD)
|
||||||
&& pipe_server)
|
|
||||||
shutdown_pending = 1;
|
shutdown_pending = 1;
|
||||||
|
|
||||||
if (opt.verbose)
|
if (opt.verbose)
|
||||||
|
@ -141,7 +141,7 @@ const char *scd_get_socket_name (void);
|
|||||||
|
|
||||||
/*-- command.c --*/
|
/*-- command.c --*/
|
||||||
gpg_error_t initialize_module_command (void);
|
gpg_error_t initialize_module_command (void);
|
||||||
int scd_command_handler (ctrl_t, gnupg_fd_t);
|
void scd_command_handler (ctrl_t, gnupg_fd_t);
|
||||||
void send_status_info (ctrl_t ctrl, const char *keyword, ...)
|
void send_status_info (ctrl_t ctrl, const char *keyword, ...)
|
||||||
GPGRT_ATTR_SENTINEL(1);
|
GPGRT_ATTR_SENTINEL(1);
|
||||||
gpg_error_t send_status_direct (ctrl_t ctrl,
|
gpg_error_t send_status_direct (ctrl_t ctrl,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user