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

Annotation of /lbbs/src/fork.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: +39 -7 lines
Content type: text/x-csrc
Fix bug

1 sysadm 1.1 /***************************************************************************
2 sysadm 1.3 fork.c - description
3 sysadm 1.1 -------------------
4 sysadm 1.2 begin : Mon Oct 18 2004
5 sysadm 1.3 copyright : (C) 2004 by Leaflet
6 sysadm 1.1 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 sysadm 1.2 #include "common.h"
19 sysadm 1.3
20     int
21     fork_server(int sock_server, int sock_client, struct sockaddr * p_sin)
22     {
23     int pid;
24     char temp[256];
25    
26     if (pid = fork ())
27     return 0;
28     else if (pid < 0)
29     return -1;
30    
31     sprintf(temp, "Child process [%d] start\n", getpid());
32     log_std (temp);
33    
34     if (close(sock_server) == -1)
35     {
36     log_error("Close server socket failed\n");
37     }
38    
39     bbs_main();
40    
41     if (close(sock_client) == -1)
42     {
43     log_error("Close client socket failed\n");
44     }
45    
46     sprintf(temp, "Child process [%d] exit\n", getpid());
47     log_std (temp);
48    
49     log_end();
50    
51     //Exit child process normally
52     exit(0);
53    
54     return 0;
55     }

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