-rw-r--r-- | core/qws/main.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/core/qws/main.cpp b/core/qws/main.cpp index bfed283..1c3c621 100644 --- a/core/qws/main.cpp +++ b/core/qws/main.cpp | |||
@@ -1,50 +1,48 @@ | |||
1 | #include <qwindowsystem_qws.h> | ||
2 | #include <qapplication.h> | ||
3 | 1 | ||
4 | #include "oqwsserver.h" | 2 | #include "oqwsserver.h" |
5 | 3 | ||
6 | #include <sys/types.h> | 4 | #include <sys/types.h> |
7 | #include <sys/stat.h> | 5 | #include <sys/stat.h> |
8 | #include <fcntl.h> | 6 | #include <fcntl.h> |
9 | #include <unistd.h> | 7 | #include <unistd.h> |
10 | 8 | ||
11 | #include <syslog.h> | 9 | #include <syslog.h> |
12 | #include <stdio.h> | 10 | #include <stdio.h> |
13 | 11 | ||
14 | #define APPNAME "op-qws" | 12 | #define APPNAME "op-qws" |
15 | 13 | ||
16 | void toSyslog(QtMsgType type, const char *msg) | 14 | void toSyslog(QtMsgType type, const char *msg) |
17 | { | 15 | { |
18 | int level = LOG_INFO; | 16 | int level = LOG_INFO; |
19 | switch (type) { | 17 | switch (type) { |
20 | case QtDebugMsg: | 18 | case QtDebugMsg: |
21 | level = LOG_DEBUG; | 19 | level = LOG_DEBUG; |
22 | break; | 20 | break; |
23 | case QtWarningMsg: | 21 | case QtWarningMsg: |
24 | level = LOG_WARNING; | 22 | level = LOG_WARNING; |
25 | break; | 23 | break; |
26 | case QtFatalMsg: | 24 | case QtFatalMsg: |
27 | level = LOG_ERR; | 25 | level = LOG_ERR; |
28 | break; | 26 | break; |
29 | } | 27 | } |
30 | syslog (LOG_DAEMON | level, msg); | 28 | syslog (LOG_DAEMON | level, msg); |
31 | } | 29 | } |
32 | 30 | ||
33 | int daemon_init(void) | 31 | int daemon_init(void) |
34 | { | 32 | { |
35 | pid_t pid; | 33 | pid_t pid; |
36 | 34 | ||
37 | if ((pid = fork()) < 0) | 35 | if ((pid = fork()) < 0) |
38 | return(-1); | 36 | return(-1); |
39 | else if (pid != 0) | 37 | else if (pid != 0) |
40 | exit(0); | 38 | exit(0); |
41 | 39 | ||
42 | setsid(); | 40 | setsid(); |
43 | 41 | ||
44 | chdir("/"); | 42 | chdir("/"); |
45 | 43 | ||
46 | umask(0); | 44 | umask(0); |
47 | 45 | ||
48 | fclose(stdout); | 46 | fclose(stdout); |
49 | fclose(stderr); | 47 | fclose(stderr); |
50 | fclose(stdin); | 48 | fclose(stdin); |