1 /*
2 * ident_buffer2socket.c
3 *
4 * (C)1999-2011 by Marc Huber <Marc.Huber@web.de>
5 * All rights reserved.
6 *
7 * $Id: ident_buffer2socket.c,v 1.11 2015/03/14 06:11:26 marc Exp marc $
8 *
9 */
10
11 #include "headers.h"
12
13 static const char rcsid[] __attribute__ ((used)) = "$Id: ident_buffer2socket.c,v 1.11 2015/03/14 06:11:26 marc Exp marc $";
14
ident_buffer2socket(struct context * ctx,int cur)15 void ident_buffer2socket(struct context *ctx, int cur __attribute__ ((unused)))
16 {
17 ssize_t l;
18
19 DebugIn(DEBUG_BUFFER);
20
21 l = write(ctx->ifn, ctx->ident_buf + ctx->ident_bufoff, ctx->ident_buflen - ctx->ident_bufoff);
22 if (l < 0) {
23 if (errno != EAGAIN)
24 cleanup_ident(ctx, ctx->ifn);
25 } else if (l == (int) (ctx->ident_buflen - ctx->ident_bufoff)) {
26 ctx->ident_buflen = 0, ctx->ident_bufoff = 0;
27 io_clr_o(ctx->io, ctx->ifn);
28 io_set_i(ctx->io, ctx->ifn);
29 } else if (l > 0)
30 ctx->ident_bufoff += l;
31
32 DebugOut(DEBUG_BUFFER);
33 }
34