diff options
author | Marcus Brinkmann <[email protected]> | 2009-09-01 17:19:45 +0000 |
---|---|---|
committer | Marcus Brinkmann <[email protected]> | 2009-09-01 17:19:45 +0000 |
commit | 7389cbf6e71c402b68a9ad61afa8b113a05ea1ea (patch) | |
tree | a3d9beea7003fd515560367c8703a5bf6a7da563 /src/assuan-buffer.c | |
parent | 2009-08-28 Marcus Brinkmann <[email protected]> (diff) | |
download | libassuan-7389cbf6e71c402b68a9ad61afa8b113a05ea1ea.tar.gz libassuan-7389cbf6e71c402b68a9ad61afa8b113a05ea1ea.zip |
doc/
2009-09-01 Marcus Brinkmann <[email protected]>
* assuan.texi: (External I/O Loop Server): Document
assuan_process_done.
(assuan_register_post_cmd_notify): Change type of ERR from int to
gpg_error_t.
(assuan_set_error): Likewise.
(assuan_register_option_handler): Change types in callback handler
from int to gpg_error_t.
(assuan_inquire_ext): Likewise.
src/
2009-09-01 Marcus Brinkmann <[email protected]>
* assuan.h: Change types in all functions from int to gpg_error_t
where relevant.
* assuan-listen.c (assuan_accept): Change type of RC from int to
gpg_error_t.
* assuan-pipe-server.c (accept_connection, finish_connection):
Change return type to gpg_error_t.
* assuan-socket-server.c (accept_connection_bottom)
(accept_connection, finish_connection): Likewise.
(assuan_init_connected_socket_server): Remove.
* assuan-defs.h (struct assuan_context_s): Change return type of
accept_handler and finish_handler to gpg_error_t.
* assuan-pipe-connect.c (do_finish): Change to void.
* assuan-inquire.c (_assuan_inquire_ext_cb): Change type of RC
from int to gpg_error_t.
* assuan-handler.c: Change return codes and RC variables from int
to gpg_error_t where appropriate.
* assuan-buffer.c (_assuan_read_line): Fix error code on EOF.
Diffstat (limited to '')
-rw-r--r-- | src/assuan-buffer.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/assuan-buffer.c b/src/assuan-buffer.c index 84538f4..e973341 100644 --- a/src/assuan-buffer.c +++ b/src/assuan-buffer.c @@ -97,13 +97,13 @@ readline (assuan_context_t ctx, char *buf, size_t buflen, gpg_error_t _assuan_read_line (assuan_context_t ctx) { + gpg_error_t rc = 0; char *line = ctx->inbound.line; int nread, atticlen; - int rc; char *endp = 0; if (ctx->inbound.eof) - return _assuan_error (-1); + return _assuan_error (GPG_ERR_EOF); atticlen = ctx->inbound.attic.linelen; if (atticlen) @@ -113,15 +113,14 @@ _assuan_read_line (assuan_context_t ctx) endp = memchr (line, '\n', atticlen); if (endp) - /* Found another line in the attic. */ { - rc = 0; + /* Found another line in the attic. */ nread = atticlen; atticlen = 0; } else - /* There is pending data but not a full line. */ { + /* There is pending data but not a full line. */ assert (atticlen < LINELENGTH); rc = readline (ctx, line + atticlen, LINELENGTH - atticlen, &nread, &ctx->inbound.eof); @@ -336,21 +335,21 @@ gpg_error_t assuan_write_line (assuan_context_t ctx, const char *line) { size_t len; - const char *s; + const char *str; - if (!ctx) + if (! ctx) return _assuan_error (GPG_ERR_ASS_INV_VALUE); /* Make sure that we never take a LF from the user - this might violate the protocol. */ - s = strchr (line, '\n'); - len = s? (s-line) : strlen (line); + str = strchr (line, '\n'); + len = str ? (str - line) : strlen (line); - if (ctx->log_fp && s) + if (ctx->log_fp && str) fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> " "[supplied line contained a LF - truncated]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), (int)ctx->inbound.fd); + (unsigned int) getpid (), (int) ctx->inbound.fd); return _assuan_write_line (ctx, NULL, line, len); } @@ -439,7 +438,7 @@ _assuan_cookie_write_data (void *cookie, const char *buffer, size_t orig_size) } ctx->outbound.data.linelen = linelen; - return (int)orig_size; + return (int) orig_size; } @@ -481,7 +480,7 @@ _assuan_cookie_write_flush (void *cookie) } *line++ = '\n'; linelen++; - if ( !(monitor_result & 2) + if (! (monitor_result & 2) && writen (ctx, ctx->outbound.data.line, linelen)) { ctx->outbound.data.error = gpg_err_code_from_syserror (); |