[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Török Edvin edwin at clamav.net
Sun Apr 4 01:12:42 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 7e98915f9bc317d1182da919a2784192d50c0a00
Author: Török Edvin <edwin at clamav.net>
Date:   Tue Dec 15 14:11:27 2009 +0200

    cli_ftw: when readdir fails, call the error callback (bb #1735).
    
    Also report all failures to clamdscan.

diff --git a/clamd/scanner.c b/clamd/scanner.c
index bae37a4..20bc686 100644
--- a/clamd/scanner.c
+++ b/clamd/scanner.c
@@ -106,8 +106,7 @@ int scan_callback(struct stat *sb, char *filename, const char *msg, enum cli_ftw
 	    scandata->errors++;
 	    return CL_EMEM;
 	case error_stat:
-	    if (msg == scandata->toplevel_path)
-		conn_reply_errno(scandata->conn, msg, "lstat() failed:");
+	    conn_reply_errno(scandata->conn, msg, "lstat() failed:");
 	    logg("^lstat() failed on: %s\n", msg);
 	    scandata->errors++;
 	    return CL_SUCCESS;
diff --git a/libclamav/others_common.c b/libclamav/others_common.c
index 0d7aba2..483613f 100644
--- a/libclamav/others_common.c
+++ b/libclamav/others_common.c
@@ -569,10 +569,11 @@ static int cli_ftw_dir(const char *dirname, int flags, int maxdepth, cli_ftw_cb
 
     if((dd = opendir(dirname)) != NULL) {
 	struct dirent *dent;
+	int err;
 	errno = 0;
 	ret = CL_SUCCESS;
 #ifdef HAVE_READDIR_R_3
-	while(!readdir_r(dd, &result.d, &dent) && dent) {
+	while(!(err = readdir_r(dd, &result.d, &dent)) && dent) {
 #elif defined(HAVE_READDIR_R_2)
 	while((dent = (struct dirent *) readdir_r(dd, &result.d))) {
 #else
@@ -680,7 +681,19 @@ static int cli_ftw_dir(const char *dirname, int flags, int maxdepth, cli_ftw_cb
 	    }
 	    errno = 0;
 	}
+#ifndef HAVE_READDIR_R_3
+	err = errno;
+#endif
 	closedir(dd);
+	if (err) {
+	    char errs[128];
+	    cli_errmsg("Unable to readdir() directory %s: %s\n", dirname,
+		       cli_strerror(errno, errs, sizeof(errs)));
+	    /* report error to callback using error_stat */
+	    ret = callback(NULL, NULL, dirname, error_stat, data);
+	    if (ret != CL_SUCCESS)
+		return ret;
+	}
 
 	if (entries) {
 	    cli_qsort(entries, entries_cnt, sizeof(*entries), ftw_compare);

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list