From aad69ae60fdf004c90d5a179d62565e40d50a5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edvin?= Date: Thu, 29 Jan 2009 09:17:15 +0000 Subject: [PATCH] add back visit_directory_toplev git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4659 77e5149b-7576-45b1-b177-96237e5ba77b --- ChangeLog | 5 +++++ clamd/scanner.c | 2 ++ libclamav/others.h | 1 + libclamav/others_common.c | 5 +++++ 4 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index ea03f94c4..c5bd4cd79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jan 29 11:39:58 EET 2009 (edwin) +------------------------------------ + * clamd/scanner.c, libclamav/others.h, libclamav/others_common.c: + add back visit_directory_toplev + Wed Jan 28 19:31:56 EET 2009 (edwin) ------------------------------------ * clamd/session.c, libclamav/others.h, libclamav/others_common.c: diff --git a/clamd/scanner.c b/clamd/scanner.c index 1fbbc1528..cae0e74da 100644 --- a/clamd/scanner.c +++ b/clamd/scanner.c @@ -349,6 +349,8 @@ int scan_callback(struct stat *sb, char *filename, const char *msg, enum cli_ftw "%s: Not supported file type. ERROR%c", msg, scandata->term); return CL_SUCCESS; + case visit_directory_toplev: + return CL_SUCCESS; case visit_file: break; } diff --git a/libclamav/others.h b/libclamav/others.h index bfb99d21a..52e608c60 100644 --- a/libclamav/others.h +++ b/libclamav/others.h @@ -376,6 +376,7 @@ int cli_matchregex(const char *str, const char *regex); enum cli_ftw_reason { visit_file, + visit_directory_toplev, /* this is a directory at toplevel of recursion */ /* must not free its args in the below cases! */ error_mem, /* recommended to return CL_EMEM */ /* recommended to return CL_SUCCESS below */ diff --git a/libclamav/others_common.c b/libclamav/others_common.c index 7b9b9cff4..5f0f7ad63 100644 --- a/libclamav/others_common.c +++ b/libclamav/others_common.c @@ -409,6 +409,11 @@ int cli_ftw(const char *path, int flags, int maxdepth, cli_ftw_cb callback, stru entry.is_dir = ft == ft_directory; entry.filename = entry.is_dir ? NULL : strdup(path); entry.dirname = entry.is_dir ? path : NULL; + if (entry.is_dir) { + int ret = callback(entry.statbuf, NULL, path, visit_directory_toplev, data); + if (ret != CL_SUCCESS) + return ret; + } return handle_entry(&entry, flags, maxdepth, callback, data); }