Sync OpenBSD patchset 225:

If there is an error in the configuration file, don't just exit(1) as this can
cause the client to hang. Instead, send the error message, then mark the client
as bad and start a normal shutdown so the server exits once the error is
written.

This also allows some code duplicating daemon(3) to be trimmed and logging to
begin earlier.

Prompted by Theo noticing the behaviour on error wasn't documented.
This commit is contained in:
Tiago Cunha
2009-08-09 17:19:18 +00:00
parent 602aae7839
commit 5b56ea1816
4 changed files with 57 additions and 43 deletions

View File

@ -1,4 +1,4 @@
/* $Id: server-fn.c,v 1.78 2009-07-30 20:21:55 tcunha Exp $ */
/* $Id: server-fn.c,v 1.79 2009-08-09 17:19:18 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -62,6 +62,8 @@ server_write_client(
{
struct hdr hdr;
if (c->flags & CLIENT_BAD)
return;
log_debug("writing %d to client %d", type, c->fd);
hdr.type = type;