~ubuntu-branches/ubuntu/utopic/clamav/utopic-security

« back to all changes in this revision

Viewing changes to unit_tests/check_bytecode.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-02-01 11:06:17 UTC
  • mfrom: (0.35.37 sid)
  • Revision ID: package-import@ubuntu.com-20140201110617-33h2xxk09dep0ui4
Tags: 0.98.1+dfsg-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes
  - Add autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  Unit tests for bytecode functions. 
3
3
 *
4
 
 *  Copyright (C) 2009 Sourcefire, Inc.
 
4
 *  Copyright (C) 2009-2012 Sourcefire, Inc.
5
5
 *
6
6
 *  Authors: Török Edvin
7
7
 *
58
58
    uint64_t v;
59
59
    struct cl_engine *engine;
60
60
    int fdin = -1;
 
61
    char filestr[512];
61
62
    const char * virname = NULL;
62
63
 
63
64
    memset(&cctx, 0, sizeof(cctx));
86
87
    bcs.all_bcs = &bc;
87
88
    bcs.count = 1;
88
89
 
89
 
    rc = cli_bytecode_load(&bc, f, NULL, 1);
 
90
    rc = cli_bytecode_load(&bc, f, NULL, 1, 0);
90
91
    fail_unless(rc == CL_SUCCESS, "cli_bytecode_load failed");
91
92
    fclose(f);
92
93
 
106
107
 
107
108
    ctx->ctx = &cctx;
108
109
    if (infile) {
109
 
        fdin = open(infile, O_RDONLY);
 
110
        snprintf(filestr, sizeof(filestr), OBJDIR"/%s", infile);
 
111
        fdin = open(filestr, O_RDONLY);
110
112
        if (fdin < 0 && errno == ENOENT)
111
113
            fdin = open_testfile(infile);
112
114
        fail_unless(fdin >= 0, "failed to open infile");