~noskcaj/ubuntu/trusty/gpgme1.0/1.4.3

« back to all changes in this revision

Viewing changes to assuan/assuan-pipe-server.c

  • Committer: Bazaar Package Importer
  • Author(s): Jose Carlos Garcia Sogo
  • Date: 2009-09-08 14:30:11 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090908143011-dv8rzfraejhex6t5
Tags: 1.2.0-1
* New Upstream Version (Closes: #545671)
* As there are new symbols introduced in this version, bump shlibs info. 
* Bump Standards-Version to 3.8.3, no changes. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * Lesser General Public License for more details.
15
15
 *
16
16
 * You should have received a copy of the GNU Lesser General Public
17
 
 * License along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19
 
 * USA. 
 
17
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
20
18
 */
21
19
 
22
20
#include <config.h>
69
67
  ctx = xtrycalloc (1, sizeof *ctx);
70
68
  if (!ctx)
71
69
    return _assuan_error (ASSUAN_Out_Of_Core);
72
 
  ctx->input_fd = -1;
73
 
  ctx->output_fd = -1;
 
70
  ctx->input_fd = ASSUAN_INVALID_FD;
 
71
  ctx->output_fd = ASSUAN_INVALID_FD;
74
72
 
75
 
  ctx->inbound.fd = -1;
76
 
  ctx->outbound.fd = -1;
 
73
  ctx->inbound.fd = ASSUAN_INVALID_FD;
 
74
  ctx->outbound.fd = ASSUAN_INVALID_FD;
77
75
  ctx->io = &io;
78
76
 
79
 
  ctx->listen_fd = -1;
 
77
  ctx->listen_fd = ASSUAN_INVALID_FD;
80
78
  /* Use the pipe server handler as a default.  */
81
79
  ctx->deinit_handler = deinit_pipe_server;
82
80
  ctx->accept_handler = accept_connection;
121
119
#ifdef HAVE_W32_SYSTEM
122
120
      /* MS Windows has so many different types of handle that one
123
121
         needs to tranlsate them at many place forth and back.  Also
124
 
         make sure that the fiel descriptos are in binary mode.  */
 
122
         make sure that the file descriptors are in binary mode.  */
125
123
      setmode (filedes[0], O_BINARY);
126
124
      setmode (filedes[1], O_BINARY);
127
 
      ctx->inbound.fd  = _get_osfhandle (filedes[0]);
128
 
      ctx->outbound.fd = _get_osfhandle (filedes[1]);
 
125
      ctx->inbound.fd  = (void*)_get_osfhandle (filedes[0]);
 
126
      ctx->outbound.fd = (void*)_get_osfhandle (filedes[1]);
129
127
#else
130
128
      s = getenv ("_assuan_connection_fd");
131
129
      if (s && *s && is_valid_socket (s) )
137
135
          _assuan_init_uds_io (ctx);
138
136
          ctx->deinit_handler = _assuan_uds_deinit;
139
137
        }
140
 
      else if (filedes && filedes[0] != -1 && filedes[1] != -1 )
 
138
      else if (filedes && filedes[0] != ASSUAN_INVALID_FD 
 
139
               && filedes[1] != ASSUAN_INVALID_FD )
141
140
        {
142
141
          /* Standard pipe server. */
143
142
          ctx->inbound.fd  = filedes[0];
168
167
{
169
168
  if (ctx)
170
169
    {
 
170
      _assuan_inquire_release (ctx);
171
171
      xfree (ctx->hello_line);
172
172
      xfree (ctx->okay_line);
173
173
      xfree (ctx->cmdtbl);