1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-11 21:48:50 +01:00

* 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.
This commit is contained in:
Werner Koch 2001-12-14 19:35:56 +00:00
parent b47b62b5f5
commit 8cd7e2ab8d
4 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2001-12-14 Werner Koch <wk@gnupg.org>
* 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.
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
* assuan-buffer.c (_assuan_read_line): New variable ATTICLEN, use

View File

@ -54,6 +54,8 @@ std_handler_bye (ASSUAN_CONTEXT ctx, char *line)
{
if (ctx->bye_notify_fnc)
ctx->bye_notify_fnc (ctx);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
return -1; /* pretty simple :-) */
}
@ -68,6 +70,8 @@ std_handler_reset (ASSUAN_CONTEXT ctx, char *line)
{
if (ctx->reset_notify_fnc)
ctx->reset_notify_fnc (ctx);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
return 0;
}

View File

@ -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;
}

View File

@ -136,6 +136,8 @@ AssuanError assuan_set_hello_line (ASSUAN_CONTEXT ctx, const char *line);
AssuanError assuan_accept (ASSUAN_CONTEXT ctx);
int assuan_get_input_fd (ASSUAN_CONTEXT ctx);
int assuan_get_output_fd (ASSUAN_CONTEXT ctx);
AssuanError assuan_close_input_fd (ASSUAN_CONTEXT ctx);
AssuanError assuan_close_output_fd (ASSUAN_CONTEXT ctx);
/*-- assuan-pipe-server.c --*/