clean_exit.c revision 1.4
11.3Ssimonb/* $NetBSD: clean_exit.c,v 1.4 1999/07/03 12:30:40 simonb Exp $ */ 21.2Schristos 31.1Smrg /* 41.1Smrg * clean_exit() cleans up and terminates the program. It should be called 51.1Smrg * instead of exit() when for some reason the real network daemon will not or 61.1Smrg * cannot be run. Reason: in the case of a datagram-oriented service we must 71.1Smrg * discard the not-yet received data from the client. Otherwise, inetd will 81.1Smrg * see the same datagram again and again, and go into a loop. 91.4Ssimonb * 101.1Smrg * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. 111.1Smrg */ 121.1Smrg 131.2Schristos#include <sys/cdefs.h> 141.1Smrg#ifndef lint 151.2Schristos#if 0 161.1Smrgstatic char sccsid[] = "@(#) clean_exit.c 1.4 94/12/28 17:42:19"; 171.2Schristos#else 181.3Ssimonb__RCSID("$NetBSD: clean_exit.c,v 1.4 1999/07/03 12:30:40 simonb Exp $"); 191.2Schristos#endif 201.1Smrg#endif 211.1Smrg 221.1Smrg#include <stdio.h> 231.2Schristos#include <stdlib.h> 241.2Schristos#include <unistd.h> 251.1Smrg 261.1Smrg#include "tcpd.h" 271.1Smrg 281.1Smrg/* clean_exit - clean up and exit */ 291.1Smrg 301.1Smrgvoid clean_exit(request) 311.1Smrgstruct request_info *request; 321.1Smrg{ 331.1Smrg 341.1Smrg /* 351.1Smrg * In case of unconnected protocols we must eat up the not-yet received 361.1Smrg * data or inetd will loop. 371.1Smrg */ 381.1Smrg 391.1Smrg if (request->sink) 401.1Smrg request->sink(request->fd); 411.1Smrg 421.1Smrg /* 431.1Smrg * Be kind to the inetd. We already reported the problem via the syslogd, 441.1Smrg * and there is no need for additional garbage in the logfile. 451.1Smrg */ 461.1Smrg 471.1Smrg sleep(5); 481.1Smrg exit(0); 491.1Smrg} 50