
dale at daleenterprise
Nov 13, 2006, 4:23 PM
Post #1 of 3
(990 views)
Permalink
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tomasz, a patch is manually applied without exception when the ClamAV software is built to work properly within the darwin environment and there are several variation of the patch but the end changes are the same, adding command-line options to manipulate the daemons. I've updated the patch to work like other OS dependant code changes/ exceptions in the related files, can this be applied permanently so a new patch doesn't have to be generated and applied whenever a new ClamAV source becomes available please? - -- Dale diff -Naur clamd/clamd.c.orig clamd/clamd.c - --- clamd/clamd.c.orig 2006-01-09 12:52:15.000000000 -0500 +++ clamd/clamd.c 2006-11-13 18:30:21.000000000 -0500 @@ -283,8 +283,15 @@ } /* fork into background */ - - if(!cfgopt(copt, "Foreground")) +#ifdef C_DARWIN + if(optc(opt, 'D') || cfgopt(copt, "Foreground")) { + logg("clamd running in foreground"); + } else { +#else + if(!cfgopt(copt, "Foreground")) { +#endif daemonize(); + } if(tcpsock) ret = tcpserver(opt, copt, root); diff -Naur clamd/options.c.orig clamd/options.c - --- clamd/options.c.orig 2006-11-13 18:35:39.000000000 -0500 +++ clamd/options.c 2006-11-13 18:37:08.000000000 -0500 @@ -45,11 +45,18 @@ int ret, opt_index, i, len; struct optstruct *opt; +#ifdef C_DARWIN + const char *getopt_parameters = "hc:VD"; +#else const char *getopt_parameters = "hc:V"; +#endif static struct option long_options[] = { {"help", 0, 0, 'h'}, {"config-file", 1, 0, 'c'}, +#ifdef C_DARWIN + {"foreground", 0, 0, 'D'}, +#endif {"version", 0, 0, 'V'}, {"debug", 0, 0, 0}, {0, 0, 0, 0} diff -Naur clamav/freshclam/freshclam.c.orig clamav/freshclam/ freshclam.c - --- clamav/freshclam/freshclam.c.orig 2005-06-19 15:22:08.000000000 - -0400 +++ clamav/freshclam/freshclam.c 2005-06-23 08:20:47.000000000 -0400 @@ -286,8 +286,15 @@ bigsleep = 24 * 3600 / checks; - - if(!cfgopt(copt, "Foreground")) +#ifdef C_DARWIN + if(optc(opt, 'D') || cfgopt(copt, "Foreground")) { + logg("freshclam running in foreground"); + } else { +#else + if(!cfgopt(copt, "Foreground")) { +#endif daemonize(); + } if (optc(opt, 'p')) { pidfile = getargc(opt, 'p'); diff -Naur clamav/freshclam/options.c.orig clamav/freshclam/options.c - --- clamav/freshclam/options.c.orig 2005-06-19 15:22:08.000000000 -0400 +++ clamav/freshclam/options.c 2005-06-23 07:43:48.000000000 -0400 @@ -38,7 +38,11 @@ int ret, opt_index, i, len; struct optstruct *opt; +#ifdef C_DARWIN + const char *getopt_parameters = "hvdp:VDl:c:u:a:"; +#else const char *getopt_parameters = "hvdp:Vl:c:u:a:"; +#endif static struct option long_options[] = { /* @@ -55,6 +59,9 @@ {"log-verbose", 0, 0, 0}, /* not used */ {"stdout", 0, 0, 0}, {"daemon", 0, 0, 'd'}, +#ifdef C_DARWIN + {"foreground", 0, 0, 'D'}, +#endif {"pid", 1, 0, 'p'}, {"user", 1, 0, 'u'}, /* not used */ {"config-file", 1, 0, 0}, -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (Darwin) iD8DBQFFWQyZiD9DTPch4RQRAqnBAJ0WWt4szmjFgZv2iQkpk9wfJcUO/wCeJNwl vbNisdnlgp96R9TkHlNMxdw= =Bby9 -----END PGP SIGNATURE----- _______________________________________________ http://lurker.clamav.net/list/clamav-devel.html
|