clamav/clamav-daemonize.patch

28 lines
503 B
Diff

--- shared/misc.c
+++ shared/misc.c
@@ -319,18 +319,12 @@
fputs("Background mode is not supported on your operating system\n", stderr);
return;
#else
- int i;
-
-
- if((i = open("/dev/null", O_WRONLY)) == -1) {
- for(i = 0; i <= 2; i++)
- close(i);
-
- } else {
- close(0);
- dup2(i, 1);
- dup2(i, 2);
- }
+ close(0);
+ open("/dev/null", O_RDONLY);
+ close(1);
+ open("/dev/null", O_WRONLY);
+ close(2);
+ open("/dev/null", O_WRONLY);
if(fork())
exit(0);