diff options
-rw-r--r-- | doc/assuan.texi | 6 | ||||
-rw-r--r-- | src/assuan-buffer.c | 6 | ||||
-rw-r--r-- | src/context.c | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/doc/assuan.texi b/doc/assuan.texi index 358357c..10b309c 100644 --- a/doc/assuan.texi +++ b/doc/assuan.texi @@ -1205,8 +1205,10 @@ The descriptor must be sent before the command is issued that makes use of the descriptor. Note that calling this function with a @var{ctx} of @code{NULL} and -@var{fd} of @code{-1} can be used as a runtime test to check whether -descriptor passing is available on the platform. If it is, 0 is returned, otherwise an error with the error code @code{GPG_ERR_NOT_IMPLEMENTED}. +@var{fd} of @code{ASSUAN_INVALID_FD} can be used as a runtime test to +check whether descriptor passing is available on the platform: +@code{0} is returned if descriptor passing is available, otherwise an +error with the error code @code{GPG_ERR_NOT_IMPLEMENTED} is returned. @end deftypefun @anchor{function assuan_receivefd} diff --git a/src/assuan-buffer.c b/src/assuan-buffer.c index 04aff5a..b442b3d 100644 --- a/src/assuan-buffer.c +++ b/src/assuan-buffer.c @@ -524,6 +524,9 @@ assuan_sendfd (assuan_context_t ctx, assuan_fd_t fd) return _assuan_error (ctx, GPG_ERR_NOT_IMPLEMENTED); #endif + if (!ctx) + return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE); + if (! ctx->engine.sendfd) return set_error (ctx, GPG_ERR_NOT_IMPLEMENTED, "server does not support sending and receiving " @@ -534,6 +537,9 @@ assuan_sendfd (assuan_context_t ctx, assuan_fd_t fd) gpg_error_t assuan_receivefd (assuan_context_t ctx, assuan_fd_t *fd) { + if (!ctx) + return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE); + if (! ctx->engine.receivefd) return set_error (ctx, GPG_ERR_NOT_IMPLEMENTED, "server does not support sending and receiving " diff --git a/src/context.c b/src/context.c index 62b7f57..147edae 100644 --- a/src/context.c +++ b/src/context.c @@ -183,8 +183,8 @@ void assuan_set_io_monitor (assuan_context_t ctx, /* Store the error in the context so that the error sending function - can take out a descriptive text. Inside the assuan code, use the - macro set_error instead of this function. */ + can take out a descriptive text. Inside the assuan code, use the + macro set_error instead of this function. */ gpg_error_t assuan_set_error (assuan_context_t ctx, gpg_error_t err, const char *text) { |