summaryrefslogtreecommitdiffstats
path: root/tpm2d
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2022-03-31 14:03:13 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2022-03-31 14:03:13 +0200
commitf584ad95048279b244083fee330c5741be2b9da7 (patch)
tree5f690c323251541b47b23b3d9e5caf02a73c0531 /tpm2d
parentdirmngr: Fix for SOCK. (diff)
downloadgnupg2-f584ad95048279b244083fee330c5741be2b9da7.tar.xz
gnupg2-f584ad95048279b244083fee330c5741be2b9da7.zip
scd,tpm2d: Fix for consistent use of socket FD.
* scd/command.c (scd_command_handler): Use gnupg_fd_t for the argument but no INT2FD to listen. Use GNUPG_INVALID_FD. * tpm2d/command.c (tpm2d_command_handler): Likewise. * scd/scdaemon.c (start_connection_thread): Follow the change. * tpm2d/tpm2daemon.c (start_connection_thread): Likewise. * scd/scdaemon.h (scd_command_handler): Use gnupg_fd_t. * tpm2d/tpm2daemon.h (tpm2d_command_handler): Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'tpm2d')
-rw-r--r--tpm2d/command.c6
-rw-r--r--tpm2d/tpm2daemon.c2
-rw-r--r--tpm2d/tpm2daemon.h2
3 files changed, 5 insertions, 5 deletions
diff --git a/tpm2d/command.c b/tpm2d/command.c
index 351781111..6f8cb5506 100644
--- a/tpm2d/command.c
+++ b/tpm2d/command.c
@@ -403,7 +403,7 @@ register_commands (assuan_context_t ctx)
server, otherwise it is a regular server. Returns true if there
are no more active asessions. */
int
-tpm2d_command_handler (ctrl_t ctrl, int fd)
+tpm2d_command_handler (ctrl_t ctrl, gnupg_fd_t fd)
{
int rc;
assuan_context_t ctx = NULL;
@@ -417,7 +417,7 @@ tpm2d_command_handler (ctrl_t ctrl, int fd)
tpm2d_exit (2);
}
- if (fd == -1)
+ if (fd == GNUPG_INVALID_FD)
{
assuan_fd_t filedes[2];
@@ -427,7 +427,7 @@ tpm2d_command_handler (ctrl_t ctrl, int fd)
}
else
{
- rc = assuan_init_socket_server (ctx, INT2FD (fd),
+ rc = assuan_init_socket_server (ctx, fd,
ASSUAN_SOCKET_SERVER_ACCEPTED);
}
if (rc)
diff --git a/tpm2d/tpm2daemon.c b/tpm2d/tpm2daemon.c
index 445e9dbbd..2fff54337 100644
--- a/tpm2d/tpm2daemon.c
+++ b/tpm2d/tpm2daemon.c
@@ -1029,7 +1029,7 @@ start_connection_thread (void *arg)
handler asked for it. With the next ticker event and given that
no other connections are running the shutdown will then
happen. */
- if (tpm2d_command_handler (ctrl, FD2INT (ctrl->thread_startup.fd))
+ if (tpm2d_command_handler (ctrl, ctrl->thread_startup.fd)
&& pipe_server)
shutdown_pending = 1;
diff --git a/tpm2d/tpm2daemon.h b/tpm2d/tpm2daemon.h
index 095978a5b..29db7a869 100644
--- a/tpm2d/tpm2daemon.h
+++ b/tpm2d/tpm2daemon.h
@@ -92,7 +92,7 @@ void tpm2d_exit (int rc);
/*-- command.c --*/
gpg_error_t initialize_module_command (void);
-int tpm2d_command_handler (ctrl_t, int);
+int tpm2d_command_handler (ctrl_t, gnupg_fd_t);
void send_client_notifications (app_t app, int removal);
void tpm2d_kick_the_loop (void);
int get_active_connection_count (void);