blob: d732ccdff85ba7bd090ce8ace9ef190718dda065 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
$FreeBSD$
--- server.cxx.orig
+++ server.cxx
@@ -32,7 +32,7 @@
<< " -a sets the secondary IP" << endl
<< " -p sets the primary port and defaults to 3478" << endl
<< " -o sets the secondary port and defaults to 3479" << endl
- << " -b makes the program run in the backgroud" << endl
+ << " -b makes the program run in the background" << endl
<< " -m sets up a STERN server starting at port m" << endl
<< " -v runs in verbose mode" << endl
// in makefile too
@@ -188,30 +188,14 @@
//exit(1);
}
-#if defined(WIN32)
- int pid=0;
-
- if ( background )
- {
- cerr << "The -b background option does not work in windows" << endl;
- exit(-1);
- }
-#else
- pid_t pid=0;
-
- if ( background )
- {
- pid = fork();
-
- if (pid < 0)
- {
- cerr << "fork: unable to fork" << endl;
- exit(-1);
- }
+ if (background) {
+ if (daemon(0,0) < 0) {
+ cerr << "daemon() call failed" << endl;
+ exit(1);
+ }
}
-#endif
- if (pid == 0) //child or not using background
+ if (1) //child or not using background
{
StunServerInfo info;
bool ok = stunInitServer(info, myAddr, altAddr, myMediaPort, verbose);
|