[clamav-users] Could not watch path /var/lib/docker/overlay2 error
Arthur Ramsey
arthurramsey19 at gmail.com
Thu Oct 10 21:01:28 UTC 2019
I have a fix for this issue. It seems to root of the problem is the use of fts which doesn’t traverse across file systems.
Here’s a patch against 1.101.4:
--- a/clamd/onaccess_hash.c
+++ b/clamd/onaccess_hash.c
@@ -33,6 +33,7 @@
#include <string.h>
#include <errno.h>
#include <stdbool.h>
+#include <mntent.h>
#include <sys/fanotify.h>
@@ -622,6 +623,22 @@ int onas_ht_add_hierarchy(struct onas_ht *ht, const char *pathname) {
if (!elem) return CL_EMEM;
if (onas_ht_insert(ht, elem)) return -1;
+
+ char buf[10240];
+ struct mntent ent;
+ struct mntent *mntent;
+ FILE *mountinfo;
+ mountinfo = setmntent("/proc/mounts", "r");
+ if (mountinfo == NULL) {
+ logg("!ScanOnAccess: setmntent failed\n");
+ return CL_EARG;
+ }
+ while ((mntent = getmntent_r(mountinfo, &ent, buf, sizeof(buf))) != NULL) {
+ if (strcmp(curr->fts_path, pathname) != 0 && strcmp(curr->fts_path, mntent->mnt_dir) == 0) {
+ onas_ht_add_hierarchy(ht, curr->fts_path);
+ }
+ }
+ endmntent(mountinfo);
}
_priv_fts_close(ftsp);
More information about the clamav-users
mailing list