From bca49a41bfb5d3f1e8ce7412d15a865cfc482516 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Wed, 26 Aug 2009 18:36:49 +0000 Subject: 2009-08-26 Marcus Brinkmann * configure.ac: Test for versioned symbols support. (LIBASSUAN_LT_CURRENT, LIBASSUAN_LT_AGE) (LIBASSUAN_LT_REVISION): New, set to 0. (LIBASSUAN_CONFIG_API_VERSION): Bump to 2. (AC_CONFIG_MACRO_DIR, AC_DISABLE_STATIC, AC_LIBTOOL_WIN32_DLL) (AC_LIBTOOL_RC, AC_PROG_LIBTOOL, AM_PATH_GPG_ERROR): Invoke. (AC_PROG_RANLIB): Don't invoke. (HAVE_W32_SYSTEM): New AM conditional. (AC_CONFIG_FILES): Add src/versioninfo.rc. * ltmain.sh, m4/libtool.m4, m4/ltoptions.m4, m4/ltsugar.m4, m4/ltversion.m4, m4/lt~obsolete.m4: New files from libtool 2.2.6. * tests/Makefile.am (AM_CFLAGS, LDADD): Add gpg-error. * tests/fdpassing.c: Change error values to gpg-error ones. src/ 2009-08-26 Marcus Brinkmann * libassuan-config.in: Add gpg-error. * assuan-buffer.c, assuan-inquire.c, assuan-handler.c, assuan-util.c, assuan-client.c, assuan-socket-connect.c, assuan-pipe-connect.c, assuan-defs.h, assuan-socket.c, assuan-connect.c, assuan-uds.c, assuan-socket-server.c, assuan-listen.c, assuan-pipe-server.c: Return gpg_error_t instead assuan_error_t everywhere. Return gpg error codes everywhere. Replace xtrymalloc, xfree, etc with _assuan_malloc, _assuan_free etc. Protect include by HAVE_CONFIG_H where not done so already. * versioninfo.rc.in, libassuan.vers, libassuan.def, assuan-error.c: New files. * Makefile.am: Add libtool handling and gpg-error (also for W32). (EXTRA_DIST): Remove mkerrors, add libassuan.vers, versioninfo.rc.in and libassuan.def. (BUILT_SOURCES, MOSTLYCLEANFILES): Removed. (common_sources): Remove assuan-errors.c, add assuan-error.c. * assuan.h: Include . [_ASSUAN_ONLY_GPG_ERRORS]: Feature removed. (assuan_init_connected_socket_server, assuan_strerror) (assuan_pipe_connect2): Removed obsolete interfaces. (assuan_error_t): Removed type. (assuan_flag_t): Changed from enum to unsigned int. (ASSUAN_NO_WAITPID, ASSUAN_CONFIDENTIAL): Changed from enum to macro. (assuan_process): Return gpg_error_t instead of int. (assuan_set_assuan_err_source): Change argument type from int to gpg_err_source_t. * assuan-defs.h (_assuan_error): Change types to gpg_error_t. (err_code, err_is_eof, xtrymalloc, xtrycalloc, xtryrealloc) (xfree): Removed. (set_error): Adjust for gpg-error codes. (_assuan_gpg_strerror_r, _assuan_gpg_strsource): Removed. (struct assuan_context_s): Remove member os_errno. * assuan-socket-server.c (accept_connection): Don't set CTX->os_errno. * mkerrors: Removed file. * assuan-io-pth.c (_assuan_simple_sendmsg) (_assuan_simple_recvmsg), assuan-io.c (_assuan_simple_sendmsg, _assuan_simple_recvmsg): Set errno instead returning error directly (and return -1). * assuan-handler.c (assuan_process_done): Remove handling for old style error values. (process_request, assuan_process): Change return type from int to gpg_error_t. * assuan-client.c (assuan_transact): Remove support for old style error values. * assuan-pipe-connect.c (assuan_pipe_connect2): Removed. * assuan-logging.c (my_strerror_r, my_strsource) (load_libgpg_error, _assuan_gpg_strerror_r) (_assuan_gpg_strsource): Removed. --- src/assuan-socket-server.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'src/assuan-socket-server.c') diff --git a/src/assuan-socket-server.c b/src/assuan-socket-server.c index c536dba..f88110d 100644 --- a/src/assuan-socket-server.c +++ b/src/assuan-socket-server.c @@ -1,23 +1,26 @@ /* assuan-socket-server.c - Assuan socket based server - * Copyright (C) 2002, 2007 Free Software Foundation, Inc. - * - * This file is part of Assuan. - * - * Assuan is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * Assuan is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, see . + Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc. + + This file is part of Assuan. + + Assuan is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + Assuan is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see . */ +#ifdef HAVE_CONFIG_H #include +#endif + #include #include #include @@ -94,14 +97,12 @@ accept_connection (assuan_context_t ctx) (struct sockaddr*)&clnt_addr, &len )); if (fd == ASSUAN_INVALID_FD) { - ctx->os_errno = errno; - return _assuan_error (ASSUAN_Accept_Failed); + return _assuan_error (gpg_err_code_from_syserror ()); } if (_assuan_sock_check_nonce (fd, &ctx->listen_nonce)) { _assuan_close (fd); - ctx->os_errno = EACCES; - return _assuan_error (ASSUAN_Accept_Failed); + return _assuan_error (GPG_ERR_ASS_ACCEPT_FAILED); } ctx->connected_fd = fd; @@ -156,9 +157,9 @@ assuan_init_socket_server_ext (assuan_context_t *r_ctx, assuan_fd_t fd, int rc; *r_ctx = NULL; - ctx = xtrycalloc (1, sizeof *ctx); + ctx = _assuan_calloc (1, sizeof *ctx); if (!ctx) - return _assuan_error (ASSUAN_Out_Of_Core); + return _assuan_error (gpg_err_code_from_syserror ()); ctx->is_server = 1; if ((flags & 2)) ctx->pipe_mode = 1; /* We want a second accept to indicate EOF. */ -- cgit v1.2.3