From d523b1c1e830092a0ce2fc5b8b9f4bcc27f04d3d Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Fri, 15 Jan 2021 20:14:50 +0200 Subject: Klamscan: handle block devices correctly. This resolves issue #12. Signed-off-by: Mavridis Philippe --- src/klamscan.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/klamscan.cpp') diff --git a/src/klamscan.cpp b/src/klamscan.cpp index 57245c4..0015088 100644 --- a/src/klamscan.cpp +++ b/src/klamscan.cpp @@ -33,6 +33,9 @@ #include #include + +#include // TDEIO does not seem to have what we need + using namespace KlamAV; Klamscan::Klamscan(TQWidget *parent, const char *name) @@ -477,9 +480,26 @@ TQStringList Klamscan::pruneSelectedDirs(){ listOfUrlsToScan.sort(); TQString prev; TQStringList prevdirs; + struct stat sb; for (TQStringList::Iterator it = listOfUrlsToScan.begin(); it != listOfUrlsToScan.end(); it++ ){ //kdDebug() << "dir: " << (*it) << endl; - (*it) = (*it).stripWhiteSpace() + "/"; + (*it) = (*it).stripWhiteSpace(); + + // replace block devices with mountpoints + lstat( (*it), &sb ); + if ( (sb.st_mode & S_IFMT) == S_IFBLK ) { + // This is actually from directorylist.cpp + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call( "properties", (*it) ); + + TQStringList properties; + reply.get( properties, "TQStringList" ); + + (*it) = * (properties.at(7) ); + } else { + (*it) = (*it) + "/"; + } + if (prevdirs.isEmpty()){ //kdDebug() << (*it) << endl; filepattern.append(*it); -- cgit v1.2.1