Hi,
Sometime ago I posted a message which provided a patch so that clamd
could log to /dev/stdout or /dev/stderr with any version of solaris
(2.6+). I needed to do this because I wanted to log output via
daemontool's multilog, and kept getting the dreaded "Could not open
logfile" error.
I also noted that although it is mentioned in the documentation, the
--foregreound|-f flags do not work from the command-line, only the
Foreground directive inside the clamd.conf file.
Attached is a patch that will change this behaviour, and allow all of
the above to happen. Please feel free to incorporate any or all of
these patches in future versions. Although this patch is for ver 0.85,
it applpied cleanly to 0.85.1 and 0.86.
--
Jorge Valdes
Intercom El Salvador
[EMAIL PROTECTED]
diff -rc2 clamav-0.85-orig/freshclam/freshclam.c
clamav-0.85/freshclam/freshclam.c
*** clamav-0.85-orig/freshclam/freshclam.c Tue May 10 18:17:19 2005
--- clamav-0.85/freshclam/freshclam.c Thu May 12 11:27:07 2005
***************
*** 287,291 ****
bigsleep = 24 * 3600 / checks;
! if(!cfgopt(copt, "Foreground"))
daemonize();
--- 287,291 ----
bigsleep = 24 * 3600 / checks;
! if(!(optc(opt, 'f') || cfgopt(copt, "Foreground")))
daemonize();
diff -rc2 clamav-0.85-orig/freshclam/options.c clamav-0.85/freshclam/options.c
*** clamav-0.85-orig/freshclam/options.c Tue May 10 19:43:09 2005
--- clamav-0.85/freshclam/options.c Thu May 12 11:47:57 2005
***************
*** 39,43 ****
struct optstruct *opt;
! const char *getopt_parameters = "hvdp:Vl:c:u:a:";
static struct option long_options[] = {
--- 39,43 ----
struct optstruct *opt;
! const char *getopt_parameters = "hvdfp:Vl:c:u:a:";
static struct option long_options[] = {
***************
*** 56,59 ****
--- 56,60 ----
{"stdout", 0, 0, 0},
{"daemon", 0, 0, 'd'},
+ {"foreground", 0, 0, 'f'},
{"pid", 1, 0, 'p'},
{"user", 1, 0, 'u'}, /* not used */
diff -rc2 clamav-0.85-orig/shared/output.c clamav-0.85/shared/output.c
*** clamav-0.85-orig/shared/output.c Tue May 10 19:43:08 2005
--- clamav-0.85/shared/output.c Wed May 11 17:35:45 2005
***************
*** 116,119 ****
--- 116,123 ----
pthread_mutex_lock(&logg_mutex);
#endif
+ if(!logg_fd)
+ if(strcmp(logg_file,"/dev/stderr")==0) logg_fd = stderr;
+ if(!logg_fd)
+ if(strcmp(logg_file,"/dev/stdout")==0) logg_fd = stdout;
if(!logg_fd) {
old_umask = umask(0037);
_______________________________________________
http://lurker.clamav.net/list/clamav-users.html