diff -ur par2cmdline-0.4/diskfile.cpp par2cmdline-0.4.patched/diskfile.cpp --- par2cmdline-0.4/diskfile.cpp 2004-04-12 13:25:37.000000000 +0200 +++ par2cmdline-0.4.patched/diskfile.cpp 2004-05-23 14:13:07.019208898 +0200 @@ -618,6 +618,12 @@ return result; } +bool is_regular_file(const string &p) +{ + struct stat st; + return (stat(p.c_str(), &st) == 0 && S_ISREG(st.st_mode)); +} + list* DiskFile::FindFiles(string path, string wildcard) { list *matches = new list; @@ -646,7 +652,8 @@ { if (name.size() >= wildcard.size() && name.substr(0, where) == front && - name.substr(name.size()-back.size()) == back) + name.substr(name.size()-back.size()) == back && + is_regular_file(path + name)) { matches->push_back(path + name); } @@ -665,7 +672,7 @@ ++pn; } - if (pw == wildcard.end()) + if (pw == wildcard.end() && is_regular_file(path + name)) { matches->push_back(path + name); } @@ -676,14 +683,9 @@ closedir(dirp); } } - else + else if (is_regular_file(path + wildcard)) { - struct stat st; - string fn = path + wildcard; - if (stat(fn.c_str(), &st) == 0) - { - matches->push_back(path + wildcard); - } + matches->push_back(path + wildcard); } return matches;