libc: make stdio_impl.h an internal libc header
[unleashed/tickless.git] / usr / src / lib / libwrap / clean_exit.c
blob4b5096279ce470570847a8dd0f1b78aee9a2f672
1 /*
2 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 #pragma ident "%Z%%M% %I% %E% SMI"
8 /*
9 * clean_exit() cleans up and terminates the program. It should be called
10 * instead of exit() when for some reason the real network daemon will not or
11 * cannot be run. Reason: in the case of a datagram-oriented service we must
12 * discard the not-yet received data from the client. Otherwise, inetd will
13 * see the same datagram again and again, and go into a loop.
15 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
18 static char sccsid[] = "@(#) clean_exit.c 1.4 94/12/28 17:42:19";
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <unistd.h>
24 extern void exit();
26 #include "tcpd.h"
28 /* clean_exit - clean up and exit */
30 void clean_exit(request)
31 struct request_info *request;
35 * In case of unconnected protocols we must eat up the not-yet received
36 * data or inetd will loop.
39 if (request->sink)
40 request->sink(request->fd);
43 * Be kind to the inetd. We already reported the problem via the syslogd,
44 * and there is no need for additional garbage in the logfile.
47 sleep(5);
48 exit(0);