Add libinotifytools build configuration.
[inoclam.git] / inoclam.c
blobfcdda74849b1e1e10b39c639f0f33ab3d651d63f
1 /*
2 * inoclam - Inotify+ClamAV virus scanner
3 * Copyright (C) 2007 Vermont Department of Taxes
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * Contributor(s):
19 * Tom Cort <tom.cort@state.vt.us>
22 #include <libdaemon/dlog.h>
24 #include "clam.h"
25 #include "inotify.h"
26 #include "sig.h"
28 int main(int argc, char *argv[], char *envp[]) {
30 /* Default Values for Global Variables */
31 exit_now = 0;
33 /* Sanity Checks */
34 if (argc < 1 || !argv || !argv[0]) {
35 daemon_log(LOG_ERR, "(%u:%s) Cannot determine program name from argv[0]\n", __FILE__, __LINE__);
36 return 1;
39 /* Configure Loggin */
40 daemon_log_ident = daemon_ident_from_argv0(argv[0]);
42 /* Install Signal Handlers */
43 install_signal_handlers();
45 /* Initialize Virus Detection Engine and Load Virus Definitions */
46 clam_init();
48 inotify_main("/home");
50 /* Free resources used by libclamav */
51 clam_exit();
53 monitor_wait(); /* thread cleanup */
54 pthread_mutex_destroy(&engine_lock);
55 pthread_attr_destroy(&ta);
57 daemon_log(LOG_INFO, "(%s:%u) Exiting...", __FILE__, __LINE__);
58 return 0;