fix build errors

git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4605 77e5149b-7576-45b1-b177-96237e5ba77b
0.95
Török Edvin 17 years ago
parent 2f6b761c7a
commit 03aefc7c37
  1. 5
      ChangeLog
  2. 2
      clamd/others.c
  3. 8
      libclamav/others.h
  4. 18
      libclamav/others_common.c

@ -1,3 +1,8 @@
Tue Jan 13 23:38:42 EET 2009 (edwin)
------------------------------------
* clamd/others.c, libclamav/others.h, libclamav/others_common.c: fix
build errors
Tue Jan 13 15:23:33 EET 2009 (edwin)
------------------------------------
* libclamav/others.h, libclamav/others_common.c: cli_ftw draft

@ -270,7 +270,7 @@ int poll_fd(int fd, int timeout_sec, int check_signals)
fds.nfds = 1;
if (fds_add(&fds, fd, 1) == -1)
return -1;
ret = poll_fds(&fd, 1, timeout_sec, check_signals);
ret = fds_poll_recv(&fds, timeout_sec, check_signals);
fds_free(&fds);
return ret;
}

@ -377,10 +377,16 @@ int cli_matchregex(const char *str, const char *regex);
enum cli_ftw_reason {
visit_file,
visit_directory,
/* must not free its args in the below cases! */
error_mem,
error_stat
error_stat,
warning_skipped
};
/* wrap void*, so that we don't mix it with some other pointer */
struct cli_ftw_cbdata {
void *data;
};
/*
* return CL_BREAK to break out without an error, CL_SUCCESS to continue,

@ -281,7 +281,7 @@ struct dirent_data {
};
/* sort files before directories, and lower inodes before higher inodes */
int ftw_compare(const void *a, const void *b)
static int ftw_compare(const void *a, const void *b)
{
const struct dirent_data *da = a;
const struct dirent_data *db = b;
@ -310,8 +310,11 @@ int cli_ftw(const char *dirname, int flags, int maxdepth, cli_ftw_cb callback, s
char *fname;
int ret;
if (maxdepth < 0)
return continue_traversal;
if (maxdepth < 0) {
/* exceeded recursion limit */
ret = callback(NULL, (char*)dirname, warning_skipped, data);
return ret;
}
if((dd = opendir(dirname)) != NULL) {
errno = 0;
@ -415,7 +418,7 @@ int cli_ftw(const char *dirname, int flags, int maxdepth, cli_ftw_cb callback, s
}
if (stated && (flags & CLI_FTW_NEED_STAT)) {
statbufp = cli_malloc(sizeof(*entry->statbuf));
statbufp = cli_malloc(sizeof(*statbufp));
if (!statbufp) {
ret = callback(stated ? &statbuf : NULL, fname, error_mem, data);
free(fname);
@ -441,7 +444,7 @@ int cli_ftw(const char *dirname, int flags, int maxdepth, cli_ftw_cb callback, s
} else {
struct dirent_data *entry = &entries[entries_cnt-1];
entry->filename = fname;
entry->stat = statbufp;
entry->statbuf = statbufp;
entry->is_dir = is_dir;
#ifdef _XOPEN_UNIX
entry->ino = dent->d_ino;
@ -456,12 +459,13 @@ int cli_ftw(const char *dirname, int flags, int maxdepth, cli_ftw_cb callback, s
if (entries) {
qsort(entries, entries_cnt, sizeof(*entries), ftw_compare);
for (i = 0; i < entries_cnt; i++) {
ret = callback(entry->stat, entry->filename,
struct dirent_data *entry = &entries[i];
ret = callback(entry->statbuf, entry->filename,
entry->is_dir ? visit_directory : visit_file,
data);
if (ret != CL_SUCCESS)
break;
if (is_dir) {
if (entry->is_dir) {
ret = cli_ftw(fname, flags, maxdepth-1, callback, data);
if (ret != CL_SUCCESS)
break;

Loading…
Cancel
Save