diff options
author | Werner Koch <[email protected]> | 2012-01-25 14:19:45 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2012-01-25 14:19:45 +0000 |
commit | 5c00c7cc2901a879927a5756e1bb7ecf49439ebc (patch) | |
tree | fbd76300739653097b2e43694f9c5b2027747fe7 | |
parent | Require gitlog-to-changelog to be installed. (diff) | |
download | libassuan-5c00c7cc2901a879927a5756e1bb7ecf49439ebc.tar.gz libassuan-5c00c7cc2901a879927a5756e1bb7ecf49439ebc.zip |
Make new functions also visible on non-W32.
* src/system-posix.c (__assuan_read, __assuan_write, __assuan_recvmsg)
(__assuan_sendmsg, __assuan_waitpid): Make functions global.
* src/libassuan.vers: Add above functions.
* configure.ac: Set version to 2.1.0-git.
-rw-r--r-- | NEWS | 16 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | doc/assuan.texi | 6 | ||||
-rw-r--r-- | src/assuan-buffer.c | 30 | ||||
-rw-r--r-- | src/libassuan.vers | 5 | ||||
-rw-r--r-- | src/system-posix.c | 42 |
6 files changed, 64 insertions, 37 deletions
@@ -1,3 +1,19 @@ +Noteworthy changes in version 2.1.0 (unreleased) +------------------------------------------------ + + * Support for the nPth library. + + * Interface changes relative to the 2.0.3 release: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ASSUAN_SYSTEM_NPTH_IMPL NEW macro. + ASSUAN_SYSTEM_NPTH NEW macro. + __assuan_read NEW (private). + __assuan_write NEW (private). + __assuan_recvmsg NEW (private). + __assuan_sendmsg NEW (private). + __assuan_waitpid NEW (private). + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Noteworthy changes in version 2.0.3 (2011-12-20) ------------------------------------------------ diff --git a/configure.ac b/configure.ac index f08a3d7..c908ef2 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ min_automake_version="1.10" # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [2.0.4]) +m4_define([my_version], [2.1.0]) m4_define([my_issvn], [yes]) m4_define([svn_revision], m4_esyscmd([printf "%d" $( (svn info 2>/dev/null \ diff --git a/doc/assuan.texi b/doc/assuan.texi index 637ad84..1d48391 100644 --- a/doc/assuan.texi +++ b/doc/assuan.texi @@ -963,6 +963,12 @@ The following system hook collections are defined by the library for your convenience: @table @code +@item ASSUAN_SYSTEM_NPTH +System hooks suitable for use with the nPth library. +@item ASSUAN_SYSTEM_NPTH_IMPL +The implementation of system hooks for use with the nPth library. +This must be invoked once somewhere in the application, and defines +the structure that is referenced by @code{ASSUAN_SYSTEM_NPTH}. @item ASSUAN_SYSTEM_PTH System hooks suitable for use with the GNU Pth library. @item ASSUAN_SYSTEM_PTH_IMPL diff --git a/src/assuan-buffer.c b/src/assuan-buffer.c index 96d1f99..f2238e7 100644 --- a/src/assuan-buffer.c +++ b/src/assuan-buffer.c @@ -46,7 +46,7 @@ writen (assuan_context_t ctx, const char *buffer, size_t length) while (length) { ssize_t nwritten = ctx->engine.writefnc (ctx, buffer, length); - + if (nwritten < 0) { if (errno == EINTR) @@ -202,7 +202,7 @@ _assuan_read_line (assuan_context_t ctx) ctx->inbound.linelen); if (monitor_result & ASSUAN_IO_MONITOR_IGNORE) ctx->inbound.linelen = 0; - + if ( !(monitor_result & ASSUAN_IO_MONITOR_NOLOG)) _assuan_log_control_channel (ctx, 0, NULL, ctx->inbound.line, ctx->inbound.linelen, @@ -211,11 +211,11 @@ _assuan_read_line (assuan_context_t ctx) } else { - _assuan_log_control_channel (ctx, 0, "invalid line", + _assuan_log_control_channel (ctx, 0, "invalid line", NULL, 0, NULL, 0); *line = 0; ctx->inbound.linelen = 0; - return _assuan_error (ctx, ctx->inbound.eof + return _assuan_error (ctx, ctx->inbound.eof ? GPG_ERR_ASS_INCOMPLETE_LINE : GPG_ERR_ASS_LINE_TOO_LONG); } @@ -261,7 +261,7 @@ assuan_pending_line (assuan_context_t ctx) } -gpg_error_t +gpg_error_t _assuan_write_line (assuan_context_t ctx, const char *prefix, const char *line, size_t len) { @@ -272,7 +272,7 @@ _assuan_write_line (assuan_context_t ctx, const char *prefix, /* Make sure that the line is short enough. */ if (len + prefixlen + 2 > ASSUAN_LINELENGTH) { - _assuan_log_control_channel (ctx, 1, + _assuan_log_control_channel (ctx, 1, "supplied line too long - truncated", NULL, 0, NULL, 0); if (prefixlen > 5) @@ -313,7 +313,7 @@ _assuan_write_line (assuan_context_t ctx, const char *prefix, } -gpg_error_t +gpg_error_t assuan_write_line (assuan_context_t ctx, const char *line) { size_t len; @@ -364,7 +364,7 @@ _assuan_cookie_write_data (void *cookie, const char *buffer, size_t orig_size) *line++ = ' '; linelen += 2; } - + /* Copy data, keep space for the CRLF and to escape one character. */ while (size && linelen < LINELENGTH-2-2) { @@ -382,8 +382,8 @@ _assuan_cookie_write_data (void *cookie, const char *buffer, size_t orig_size) } size--; } - - + + monitor_result = 0; if (ctx->io_monitor) monitor_result = ctx->io_monitor (ctx, ctx->io_monitor_data, 1, @@ -414,7 +414,7 @@ _assuan_cookie_write_data (void *cookie, const char *buffer, size_t orig_size) } -/* Write out any buffered data +/* Write out any buffered data This function is used for GNU's custom streams */ int _assuan_cookie_write_flush (void *cookie) @@ -435,7 +435,7 @@ _assuan_cookie_write_flush (void *cookie) if (ctx->io_monitor) monitor_result = ctx->io_monitor (ctx, ctx->io_monitor_data, 1, ctx->outbound.data.line, linelen); - + if (linelen) { if (!(monitor_result & ASSUAN_IO_MONITOR_NOLOG)) @@ -461,7 +461,7 @@ _assuan_cookie_write_flush (void *cookie) * @ctx: An assuan context * @buffer: Data to send or NULL to flush * @length: length of the data to send/ - * + * * This function may be used by the server or the client to send data * lines. The data will be escaped as required by the Assuan protocol * and may get buffered until a line is full. To force sending the @@ -470,10 +470,10 @@ _assuan_cookie_write_flush (void *cookie) * also send the terminating "END" command to terminate the reponse on * a INQUIRE response. However, when assuan_transact() is used, this * function takes care of sending END itself. - * + * * If BUFFER is NULL and LENGTH is 1 and we are a client, a "CAN" is * send instead of an "END". - * + * * Return value: 0 on success or an error code **/ diff --git a/src/libassuan.vers b/src/libassuan.vers index 8126fab..8f3419f 100644 --- a/src/libassuan.vers +++ b/src/libassuan.vers @@ -108,6 +108,11 @@ LIBASSUAN_1.0 { __assuan_usleep; __assuan_socket; __assuan_connect; + __assuan_read; + __assuan_write; + __assuan_recvmsg; + __assuan_sendmsg; + __assuan_waitpid; local: *; diff --git a/src/system-posix.c b/src/system-posix.c index 68294c0..5bdc676 100644 --- a/src/system-posix.c +++ b/src/system-posix.c @@ -62,17 +62,17 @@ __assuan_usleep (assuan_context_t ctx, unsigned int usec) { struct timespec req; struct timespec rem; - + req.tv_sec = 0; req.tv_nsec = usec * 1000; - + while (nanosleep (&req, &rem) < 0 && errno == EINTR) req = rem; } #else { struct timeval tv; - + tv.tv_sec = usec / 1000000; tv.tv_usec = usec % 1000000; select (0, NULL, NULL, NULL, &tv); @@ -101,7 +101,7 @@ __assuan_close (assuan_context_t ctx, assuan_fd_t fd) -static ssize_t +ssize_t __assuan_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size) { return read (fd, buffer, size); @@ -109,7 +109,7 @@ __assuan_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size) -static ssize_t +ssize_t __assuan_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, size_t size) { @@ -118,7 +118,7 @@ __assuan_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, -static int +int __assuan_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, int flags) { @@ -133,7 +133,7 @@ __assuan_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, -static int +int __assuan_sendmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, int flags) { @@ -154,7 +154,7 @@ writen (int fd, const char *buffer, size_t length) while (length) { int nwritten = write (fd, buffer, length); - + if (nwritten < 0) { if (errno == EINTR) @@ -201,7 +201,7 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, "can't open `/dev/null': %s", strerror (errno)); _exit (4); } - + /* Dup handles to stdin/stdout. */ if (fd_out != STDOUT_FILENO) { @@ -213,7 +213,7 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, _exit (4); } } - + if (fd_in != STDIN_FILENO) { if (dup2 (fd_in == ASSUAN_INVALID_FD ? fdnul : fd_in, @@ -224,7 +224,7 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, _exit (4); } } - + /* Dup stderr to /dev/null unless it is in the list of FDs to be passed to the child. */ fdp = fd_child_list; @@ -243,7 +243,7 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, } } close (fdnul); - + /* Close all files which will not be duped and are not in the fd_child_list. */ n = sysconf (_SC_OPEN_MAX); @@ -259,24 +259,24 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, while (*fdp != -1 && *fdp != i) fdp++; } - + if (!(fdp && *fdp != -1)) close (i); } gpg_err_set_errno (0); - + if (! name) { /* No name and no args given, thus we don't do an exec but continue the forked process. */ *argv = "server"; - + /* FIXME: Cleanup. */ return 0; } - - execv (name, (char *const *) argv); - + + execv (name, (char *const *) argv); + /* oops - use the pipe to tell the parent about it */ snprintf (errbuf, sizeof(errbuf)-1, "ERR %d can't exec `%s': %.50s\n", @@ -289,7 +289,7 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, if (! name) *argv = "client"; - + *r_pid = pid; return 0; @@ -299,7 +299,7 @@ __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, /* FIXME: Add some sort of waitpid function that covers GPGME and gpg-agent's use of assuan. */ -static pid_t +pid_t __assuan_waitpid (assuan_context_t ctx, pid_t pid, int nowait, int *status, int options) { @@ -307,7 +307,7 @@ __assuan_waitpid (assuan_context_t ctx, pid_t pid, int nowait, NOWAIT in POSIX systems just means the caller already did the waitpid for this child. */ if (! nowait) - return waitpid (pid, NULL, 0); + return waitpid (pid, NULL, 0); return 0; } |