~ubuntu-branches/ubuntu/raring/clamav/raring

« back to all changes in this revision

Viewing changes to freshclam/execute.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran
  • Date: 2008-09-05 17:25:34 UTC
  • mfrom: (0.35.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080905172534-yi3f8fkye1o7u1r3
* New upstream version (closes: #497662, #497773)
  - lots of new options for clamd.conf
  - fixes CVEs CVE-2008-3912, CVE-2008-3913, CVE-2008-3914, and
    CVE-2008-1389
* No longer supports --unzip option, so typo is gone (closes: #496276)
* Translations:
  - sv (thanks Martin Bagge <brother@bsnet.se>) (closes: #491760)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#endif
34
34
 
35
35
#include "shared/output.h"
 
36
#include "shared/options.h"
36
37
#include "execute.h"
37
38
 
38
39
#define MAX_CHILDREN 5
39
40
 
40
41
int active_children;
41
42
 
42
 
void execute( const char *type, const char *text )
 
43
void execute( const char *type, const char *text, const struct optstruct *opt )
43
44
{
 
45
        int ret;
 
46
#ifndef C_WINDOWS
 
47
        pid_t pid;
 
48
#endif
 
49
 
 
50
    if(!opt_check(opt, "daemon")) {
 
51
        if(sscanf(text, "EXIT_%d", &ret) == 1) {
 
52
            logg("*%s: EXIT_%d\n", type, ret);
 
53
            exit(ret);
 
54
        }
 
55
        if(system(text) == -1) {
 
56
            logg("%s: system(%s) failed\n", type, text);
 
57
            return;
 
58
        }
 
59
    }
 
60
 
44
61
#ifdef        C_WINDOWS
45
62
        if(active_children < MAX_CHILDREN) {
46
63
                if(spawnlp(P_DETACH, text, text, NULL) == -1) {
51
68
        } else
52
69
                logg("^%s: already %d processes active.\n", type, active_children);
53
70
#else
54
 
        pid_t pid;
55
 
 
56
71
        if ( active_children<MAX_CHILDREN )
57
72
        switch( pid=fork() ) {
58
73
        case 0: