cli_sftw -> cli_ftw, and hide old cli_ftw

git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4658 77e5149b-7576-45b1-b177-96237e5ba77b
remotes/push_mirror/0.95
Török Edvin 17 years ago
parent 66b47dd3ba
commit 5bae92695c
  1. 5
      ChangeLog
  2. 2
      clamd/session.c
  3. 8
      libclamav/others.h
  4. 9
      libclamav/others_common.c

@ -1,3 +1,8 @@
Wed Jan 28 19:31:56 EET 2009 (edwin)
------------------------------------
* clamd/session.c, libclamav/others.h, libclamav/others_common.c:
cli_sftw -> cli_ftw, and hide old cli_ftw
Wed Jan 28 19:25:28 EET 2009 (edwin)
------------------------------------
* clamd/scanner.c, clamd/scanner.h, clamd/session.c,

@ -214,7 +214,7 @@ int command(client_conn_t *conn, int timeout)
thrmgr_setactivetask(buff+strlen(CMD13)+1, CMD13);
int maxdirrec = optget(opts, "MaxDirectoryRecursion")->numarg;
if (cli_sftw(path, CLI_FTW_STD, maxdirrec ? maxdirrec : INT_MAX, scan_callback, &data) == CL_EMEM)
if (cli_ftw(path, CLI_FTW_STD, maxdirrec ? maxdirrec : INT_MAX, scan_callback, &data) == CL_EMEM)
if(optget(opts, "ExitOnOOM")->enabled)
return COMMAND_SHUTDOWN;
thrmgr_group_waitforall(&group, &ok, &error, &total);

@ -409,12 +409,10 @@ typedef int (*cli_ftw_cb)(struct stat *stat_buf, char *filename, const char *msg
* returns we don't know the infected/notinfected status of the directory yet!
* Due to this if the callback scans synchronously it should store the infected
* status in its cbdata.
* This works for both files and directories. It stats the path to determine
* which one it is.
* If it is a file, it simply calls the callback once, otherwise recurses.
*/
int cli_ftw(const char *base, int flags, int maxdepth, cli_ftw_cb callback, struct cli_ftw_cbdata *data);
/* Like cli_ftw() but works both for files and directories.
* If it is a file, it simply calls the callback once, otherwise recurses.
* Path must point to malloced memory, that will be freed. */
int cli_sftw(const char *path, int flags, int maxdepth, cli_ftw_cb callback, struct cli_ftw_cbdata *data);
#endif

@ -384,16 +384,17 @@ static int handle_filetype(const char *fname, int flags,
return CL_SUCCESS;
}
static int cli_ftw_dir(const char *dirname, int flags, int maxdepth, cli_ftw_cb callback, struct cli_ftw_cbdata *data);
static int handle_entry(struct dirent_data *entry, int flags, int maxdepth, cli_ftw_cb callback, struct cli_ftw_cbdata *data)
{
if (!entry->is_dir) {
return callback(entry->statbuf, entry->filename, NULL, visit_file, data);
} else {
return cli_ftw(entry->dirname, flags, maxdepth, callback, data);
return cli_ftw_dir(entry->dirname, flags, maxdepth, callback, data);
}
}
int cli_sftw(const char *path, int flags, int maxdepth, cli_ftw_cb callback, struct cli_ftw_cbdata *data)
int cli_ftw(const char *path, int flags, int maxdepth, cli_ftw_cb callback, struct cli_ftw_cbdata *data)
{
struct stat statbuf;
enum filetype ft = ft_unknown;
@ -411,7 +412,7 @@ int cli_sftw(const char *path, int flags, int maxdepth, cli_ftw_cb callback, str
return handle_entry(&entry, flags, maxdepth, callback, data);
}
int cli_ftw(const char *dirname, int flags, int maxdepth, cli_ftw_cb callback, struct cli_ftw_cbdata *data)
static int cli_ftw_dir(const char *dirname, int flags, int maxdepth, cli_ftw_cb callback, struct cli_ftw_cbdata *data)
{
DIR *dd;
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
@ -601,7 +602,7 @@ int main(int argc, char *argv[])
if (argc != 2)
return 1;
data.data = &files;
cli_ftw(argv[1], CLI_FTW_STD, 16, tst_cb, &data);
cli_ftw_dir(argv[1], CLI_FTW_STD, 16, tst_cb, &data);
return 0;
}
#endif

Loading…
Cancel
Save