X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/3884054be9261b4607f5f3a2d0b79695f65b851f..962dd3329d51f1d18313a17eb0cb4695ee4421a0:/pixie.c diff --git a/pixie.c b/pixie.c index f2a3b2f..ba1285a 100644 --- a/pixie.c +++ b/pixie.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: pixie.c,v 1.11 2002/01/13 13:43:05 mdw Exp $ + * $Id: pixie.c,v 1.13 2004/03/21 22:43:05 mdw Exp $ * * Passphrase pixie for Catacomb * @@ -30,6 +30,12 @@ /*----- Revision history --------------------------------------------------* * * $Log: pixie.c,v $ + * Revision 1.13 2004/03/21 22:43:05 mdw + * Keep quiet about expected errors on incoming connections. + * + * Revision 1.12 2002/01/13 13:50:42 mdw + * Various fixes tracking mLib changes. + * * Revision 1.11 2002/01/13 13:43:05 mdw * Fix bug in daemon mode. * @@ -172,7 +178,7 @@ static void log(const char *p, ...) d.len += strftime(d.buf, d.sz, "%Y-%m-%d %H:%M:%S ", tm); } va_start(ap, p); - dstr_vputf(&d, p, ap); + dstr_vputf(&d, p, &ap); va_end(ap); if (flags & F_SYSLOG) @@ -658,7 +664,7 @@ static void pixserv_write(pixserv *px, const char *p, ...) va_list ap; va_start(ap, p); - dstr_vputf(&d, p, ap); + dstr_vputf(&d, p, &ap); write(px->fd, d.buf, d.len); va_end(ap); dstr_destroy(&d); @@ -696,6 +702,7 @@ static unsigned long pixserv_timeout(const char *p) /* --- @pixserv_line@ --- * * * Arguments: @char *s@ = pointer to the line read + * @size_t len@ = length of the line * @void *p@ = pointer to server block * * Returns: --- @@ -703,7 +710,7 @@ static unsigned long pixserv_timeout(const char *p) * Use: Handles a line read from the client. */ -static void pixserv_line(char *s, void *p) +static void pixserv_line(char *s, size_t len, void *p) { pixserv *px = p; char *q, *qq; @@ -898,7 +905,8 @@ static void pixserv_accept(int fd, unsigned mode, void *p) if (mode != SEL_READ) return; if ((nfd = accept(fd, (struct sockaddr *)&sun, &sunsz)) < 0) { - if (verbose) + if (verbose && errno != EAGAIN && errno != EWOULDBLOCK && + errno != ECONNABORTED && errno != EPROTO && errno != EINTR) log("new connection failed: %s", strerror(errno)); return; } @@ -1087,21 +1095,19 @@ static unsigned c_flags = 0; /* --- Line handler functions --- */ -static void c_uline(char *s, void *p) +static void c_uline(char *s, size_t len, void *p) { - size_t sz; if (!s) { selbuf_destroy(&c_client); shutdown(c_server.reader.fd, 1); c_flags |= cf_uclose; } else { - sz = strlen(s); - s[sz++] = '\n'; - write(c_server.reader.fd, s, sz); + s[len++] = '\n'; + write(c_server.reader.fd, s, len); } } -static void c_sline(char *s, void *p) +static void c_sline(char *s, size_t len, void *p) { if (!s) { selbuf_destroy(&c_server);