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

Annotation of src/lib/libwrap/clean_exit.c, Revision 1.5

1.5     ! matt        1: /*     $NetBSD: clean_exit.c,v 1.4 1999/07/03 12:30:40 simonb Exp $    */
1.2       christos    2:
1.1       mrg         3:  /*
                      4:   * clean_exit() cleans up and terminates the program. It should be called
                      5:   * instead of exit() when for some reason the real network daemon will not or
                      6:   * cannot be run. Reason: in the case of a datagram-oriented service we must
                      7:   * discard the not-yet received data from the client. Otherwise, inetd will
                      8:   * see the same datagram again and again, and go into a loop.
1.4       simonb      9:   *
1.1       mrg        10:   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
                     11:   */
                     12:
1.2       christos   13: #include <sys/cdefs.h>
1.1       mrg        14: #ifndef lint
1.2       christos   15: #if 0
1.1       mrg        16: static char sccsid[] = "@(#) clean_exit.c 1.4 94/12/28 17:42:19";
1.2       christos   17: #else
1.5     ! matt       18: __RCSID("$NetBSD: clean_exit.c,v 1.4 1999/07/03 12:30:40 simonb Exp $");
1.2       christos   19: #endif
1.1       mrg        20: #endif
                     21:
                     22: #include <stdio.h>
1.2       christos   23: #include <stdlib.h>
                     24: #include <unistd.h>
1.1       mrg        25:
                     26: #include "tcpd.h"
                     27:
                     28: /* clean_exit - clean up and exit */
                     29:
1.5     ! matt       30: void
        !            31: clean_exit(struct request_info *request)
1.1       mrg        32: {
                     33:
                     34:     /*
                     35:      * In case of unconnected protocols we must eat up the not-yet received
                     36:      * data or inetd will loop.
                     37:      */
                     38:
                     39:     if (request->sink)
                     40:        request->sink(request->fd);
                     41:
                     42:     /*
                     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.
                     45:      */
                     46:
                     47:     sleep(5);
                     48:     exit(0);
                     49: }

CVSweb <webmaster@jp.NetBSD.org>