[BACK]Return to clean_exit.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libwrap

File: [cvs.NetBSD.org] / src / lib / libwrap / clean_exit.c (download)

Revision 1.4.66.2, Mon Apr 23 23:40:41 2012 UTC (11 years, 11 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Changes since 1.4.66.1: +4 -4 lines

Back out changes committed as part of ticket #195 which were apparently
not intended as part of the pullup request.  Should fix netbsd-6 build.

/*	$NetBSD: clean_exit.c,v 1.4.66.2 2012/04/23 23:40:41 riz Exp $	*/

 /*
  * clean_exit() cleans up and terminates the program. It should be called
  * instead of exit() when for some reason the real network daemon will not or
  * cannot be run. Reason: in the case of a datagram-oriented service we must
  * discard the not-yet received data from the client. Otherwise, inetd will
  * see the same datagram again and again, and go into a loop.
  * 
  * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
  */

#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#) clean_exit.c 1.4 94/12/28 17:42:19";
#else
__RCSID("$NetBSD: clean_exit.c,v 1.4.66.2 2012/04/23 23:40:41 riz Exp $");
#endif
#endif

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include "tcpd.h"

/* clean_exit - clean up and exit */

void    clean_exit(request)
struct request_info *request;
{

    /*
     * In case of unconnected protocols we must eat up the not-yet received
     * data or inetd will loop.
     */

    if (request->sink)
	request->sink(request->fd);

    /*
     * Be kind to the inetd. We already reported the problem via the syslogd,
     * and there is no need for additional garbage in the logfile.
     */

    sleep(5);
    exit(0);
}