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

Contents of /lbbs/src/fork.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Tue Oct 19 02:12:28 2004 UTC (21 years, 5 months ago) by sysadm
Branch: MAIN
Changes since 1.4: +2 -5 lines
Content type: text/x-csrc
Remove unnecessary message

1 /***************************************************************************
2 fork.c - description
3 -------------------
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
20 int
21 fork_server(int sock_server, int sock_client, struct sockaddr_in * p_sin)
22 {
23 int pid;
24
25 if (pid = fork ())
26 return 0;
27 else if (pid < 0)
28 return -1;
29
30 log_std ("Child process start\n");
31
32 if (close(sock_server) == -1)
33 {
34 log_error("Close server socket failed\n");
35 }
36
37 socket_client = sock_client;
38 strcpy(hostaddr_client,inet_ntoa(p_sin->sin_addr));
39 port_client = ntohs(p_sin->sin_port);
40
41 bbs_main();
42
43 if (close(sock_client) == -1)
44 {
45 log_error("Close client socket failed\n");
46 }
47
48 log_std ("Child process exit\n");
49
50 log_end();
51
52 //Exit child process normally
53 exit(0);
54
55 return 0;
56 }

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