/[LeafOK_CVS]/lbbs/src/init.c
ViewVC logotype

Annotation of /lbbs/src/init.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Mon Oct 18 11:34:15 2004 UTC (21 years, 5 months ago) by sysadm
Branch: MAIN
Changes since 1.2: +2 -2 lines
Content type: text/x-csrc
Fix bug

1 sysadm 1.1 /***************************************************************************
2 sysadm 1.3 init.c - description
3 sysadm 1.1 -------------------
4     begin : Mon Oct 18 2004
5     copyright : (C) 2004 by Leaflet
6     email : leaflet@leafok.com
7     ***************************************************************************/
8    
9     /***************************************************************************
10     * *
11     * This program is free software; you can redistribute it and/or modify *
12     * it under the terms of the GNU General Public License as published by *
13     * the Free Software Foundation; either version 2 of the License, or *
14     * (at your option) any later version. *
15     * *
16     ***************************************************************************/
17    
18     #include "common.h"
19     #include <signal.h>
20    
21     void
22     init_daemon (void)
23     {
24     int pid;
25     int i;
26    
27     if (pid = fork ())
28     exit (0);
29     else if (pid < 0)
30     exit (1);
31    
32     setsid ();
33    
34     if (pid = fork ())
35     exit (0);
36     else if (pid < 0)
37     exit (1);
38    
39     for (i = 0; i < NOFILE; ++i)
40     close (i);
41 sysadm 1.3 chdir (app_home_dir);
42 sysadm 1.1 umask (0);
43    
44 sysadm 1.2 signal (SIGCHLD, SIG_IGN);
45 sysadm 1.1
46     return;
47     }

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1