aboutsummaryrefslogtreecommitdiffstats
path: root/assuan/assuan-listen.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2001-12-14 19:35:56 +0000
committerWerner Koch <[email protected]>2001-12-14 19:35:56 +0000
commit8cd7e2ab8d81aa432c236aee64c9f6cb02bc0c20 (patch)
tree62d92dfc604ae6b663b1e7a4c524906521d97864 /assuan/assuan-listen.c
parent* gpgsm.c (main): New option --debug-wait n, so that it is (diff)
downloadgnupg-8cd7e2ab8d81aa432c236aee64c9f6cb02bc0c20.tar.gz
gnupg-8cd7e2ab8d81aa432c236aee64c9f6cb02bc0c20.zip
* assuan-listen.c (assuan_close_input_fd): New.
(assuan_close_output_fd): New. * assuan-handler.c (std_handler_reset): Always close them after a reset command. (std_handler_bye): Likewise.
Diffstat (limited to 'assuan/assuan-listen.c')
-rw-r--r--assuan/assuan-listen.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/assuan/assuan-listen.c b/assuan/assuan-listen.c
index 822ef32cd..57fe4b669 100644
--- a/assuan/assuan-listen.c
+++ b/assuan/assuan-listen.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include "assuan-defs.h"
@@ -106,3 +107,28 @@ assuan_get_output_fd (ASSUAN_CONTEXT ctx)
}
+/* Close the fd descriptor set by the command INPUT FD=n. We handle
+ this fd inside assuan so that we can do some initial checks */
+AssuanError
+assuan_close_input_fd (ASSUAN_CONTEXT ctx)
+{
+ if (!ctx || ctx->input_fd == -1)
+ return ASSUAN_Invalid_Value;
+ close (ctx->input_fd);
+ ctx->input_fd = -1;
+ return 0;
+}
+
+/* Close the fd descriptor set by the command OUTPUT FD=n. We handle
+ this fd inside assuan so that we can do some initial checks */
+AssuanError
+assuan_close_output_fd (ASSUAN_CONTEXT ctx)
+{
+ if (!ctx || ctx->output_fd == -1)
+ return ASSUAN_Invalid_Value;
+
+ close (ctx->output_fd);
+ ctx->output_fd = -1;
+ return 0;
+}
+