git-svn: trunk@4225
aCaB authored on 2008/10/04 02:15:03... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Fri Oct 3 19:28:18 CEST 2008 (acab) |
|
2 |
+------------------------------------ |
|
3 |
+ * clamav-milter/clamav-milter.c: properly close descriptors before |
|
4 |
+ forking (bb#1137) |
|
5 |
+ |
|
1 | 6 |
Fri Oct 3 20:22:58 EEST 2008 (edwin) |
2 | 7 |
------------------------------------- |
3 | 8 |
* configure.in, */Makefile.am: link to libclamunrar_iface explicitly to allow non-rpath builds to work. (bb #1203) |
... | ... |
@@ -1925,7 +1925,20 @@ main(int argc, char **argv) |
1925 | 1925 |
} |
1926 | 1926 |
dup(consolefd); |
1927 | 1927 |
#else |
1928 |
+ int fds[3]; |
|
1928 | 1929 |
logg_file = NULL; |
1930 |
+ chdir("/"); |
|
1931 |
+ fds[0] = open("/dev/null", O_RDONLY); |
|
1932 |
+ fds[1] = open("/dev/null", O_WRONLY); |
|
1933 |
+ fds[2] = open("/dev/null", O_WRONLY); |
|
1934 |
+ for(i = 0; i <= 2; i++) { |
|
1935 |
+ if(fds[i] == -1 || dup2(fds[i], i) == -1) { |
|
1936 |
+ fprintf(stderr, "ERROR: failed to daemonize.\n"); |
|
1937 |
+ logg_close(); |
|
1938 |
+ freecfg(copt); |
|
1939 |
+ return 1; |
|
1940 |
+ } |
|
1941 |
+ } |
|
1929 | 1942 |
#endif |
1930 | 1943 |
} |
1931 | 1944 |
|