144743Smarkm /* 244743Smarkm * clean_exit() cleans up and terminates the program. It should be called 344743Smarkm * instead of exit() when for some reason the real network daemon will not or 444743Smarkm * cannot be run. Reason: in the case of a datagram-oriented service we must 544743Smarkm * discard the not-yet received data from the client. Otherwise, inetd will 644743Smarkm * see the same datagram again and again, and go into a loop. 744743Smarkm * 844743Smarkm * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. 944743Smarkm */ 1044743Smarkm 1144743Smarkm#ifndef lint 1244743Smarkmstatic char sccsid[] = "@(#) clean_exit.c 1.4 94/12/28 17:42:19"; 1344743Smarkm#endif 1444743Smarkm 1544743Smarkm#include <stdio.h> 1644743Smarkm 1744743Smarkmextern void exit(); 1844743Smarkm 1944743Smarkm#include "tcpd.h" 2044743Smarkm 2144743Smarkm/* clean_exit - clean up and exit */ 2244743Smarkm 2344743Smarkmvoid clean_exit(request) 2444743Smarkmstruct request_info *request; 2544743Smarkm{ 2644743Smarkm 2744743Smarkm /* 2844743Smarkm * In case of unconnected protocols we must eat up the not-yet received 2944743Smarkm * data or inetd will loop. 3044743Smarkm */ 3144743Smarkm 3244743Smarkm if (request->sink) 3344743Smarkm request->sink(request->fd); 3444743Smarkm 3544743Smarkm /* 3644743Smarkm * Be kind to the inetd. We already reported the problem via the syslogd, 3744743Smarkm * and there is no need for additional garbage in the logfile. 3844743Smarkm */ 3944743Smarkm 4044743Smarkm sleep(5); 4144743Smarkm exit(0); 4244743Smarkm} 43