Ticket #7202: 00-exception-safe-directory-iterator.2.patch

File 00-exception-safe-directory-iterator.2.patch, 1.3 KB (added by batsun@…, 10 years ago)

correct patch for boost 1.47

  • ./boost_1_47_0/libs/filesystem/v3/src/operations.cpp

    diff -ru ./boost_1_47_0/libs/filesystem/v3/src/operations.cpp ./boost_1_47_0/libs/filesystem/v3/src/operations.cpp
     
    389389
    390390    if (type == fs::directory_file)  // but not a directory symlink
    391391    {
    392       for (fs::directory_iterator itr(p);
     392      if (ec != 0) {
     393        for (fs::directory_iterator itr(p, *ec);
    393394            itr != end_dir_itr; ++itr)
    394       {
    395         fs::file_type tmp_type = query_file_type(itr->path(), ec);
    396         if (ec != 0 && *ec)
    397           return count;
    398         count += remove_all_aux(itr->path(), tmp_type, ec);
     395        {
     396          if (*ec)
     397            return count;
     398          fs::file_type tmp_type = query_file_type(itr->path(), ec);
     399          if (*ec)
     400            return count;
     401          count += remove_all_aux(itr->path(), tmp_type, ec);
     402        }
     403      } else {
     404        for (fs::directory_iterator itr(p);
     405              itr != end_dir_itr; ++itr)
     406        {
     407          fs::file_type tmp_type = query_file_type(itr->path(), ec);;
     408          count += remove_all_aux(itr->path(), tmp_type, ec);
     409        }
    399410      }
    400411    }
    401412    remove_file_or_directory(p, type, ec);