Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 51817 | Differences between
and this patch

Collapse All | Expand All

(-)par2cmdline-0.4/diskfile.cpp (-9 / +11 lines)
Lines 618-623 Link Here
618
  return result;
618
  return result;
619
}
619
}
620
620
621
bool is_regular_file(const string &p)
622
{
623
  struct stat st;
624
  return (stat(p.c_str(), &st) == 0 && S_ISREG(st.st_mode));
625
}
626
621
list<string>* DiskFile::FindFiles(string path, string wildcard)
627
list<string>* DiskFile::FindFiles(string path, string wildcard)
622
{
628
{
623
  list<string> *matches = new list<string>;
629
  list<string> *matches = new list<string>;
Lines 646-652 Link Here
646
        {
652
        {
647
          if (name.size() >= wildcard.size() &&
653
          if (name.size() >= wildcard.size() &&
648
              name.substr(0, where) == front &&
654
              name.substr(0, where) == front &&
649
              name.substr(name.size()-back.size()) == back)
655
              name.substr(name.size()-back.size()) == back &&
656
              is_regular_file(path + name))
650
          {
657
          {
651
            matches->push_back(path + name);
658
            matches->push_back(path + name);
652
          }
659
          }
Lines 665-671 Link Here
665
              ++pn;
672
              ++pn;
666
            }
673
            }
667
674
668
            if (pw == wildcard.end())
675
            if (pw == wildcard.end() && is_regular_file(path + name))
669
            {
676
            {
670
              matches->push_back(path + name);
677
              matches->push_back(path + name);
671
            }
678
            }
Lines 676-689 Link Here
676
      closedir(dirp);
683
      closedir(dirp);
677
    }
684
    }
678
  }
685
  }
679
  else
686
  else if (is_regular_file(path + wildcard))
680
  {
687
  {
681
    struct stat st;
688
    matches->push_back(path + wildcard);
682
    string fn = path + wildcard;
683
    if (stat(fn.c_str(), &st) == 0)
684
    {
685
      matches->push_back(path + wildcard);
686
    }
687
  }
689
  }
688
690
689
  return matches;
691
  return matches;

Return to bug 51817