diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 1997-04-08 00:29:19 +0000 |
---|---|---|
committer | <> | 2013-02-25 15:20:59 +0000 |
commit | f8d9d05cfb1ea783457a14d3cf7fdf4d8fa450f2 (patch) | |
tree | 058251f5aa8af2365812daa56d936e91720a6027 /clean_exit.c | |
download | tcp-wrappers-master.tar.gz |
Imported from /home/lorry/working-area/delta_tcp-wrappers/tcp_wrappers_7.6.tar.gz.HEADtcp_wrappers_7.6master
Diffstat (limited to 'clean_exit.c')
-rw-r--r-- | clean_exit.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/clean_exit.c b/clean_exit.c new file mode 100644 index 0000000..cb9d4f5 --- /dev/null +++ b/clean_exit.c @@ -0,0 +1,42 @@ + /* + * 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. + */ + +#ifndef lint +static char sccsid[] = "@(#) clean_exit.c 1.4 94/12/28 17:42:19"; +#endif + +#include <stdio.h> + +extern void exit(); + +#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); +} |