Browse Source

error if file couldnt be opened

Patrick Brosi 6 years ago
parent
commit
8fd20b56be
1 changed files with 1 additions and 0 deletions
  1. 1 0
      File.cpp

+ 1 - 0
File.cpp

@@ -42,6 +42,7 @@ void File::reset() {
42
 
42
 
43
   if (_file) close(_file);
43
   if (_file) close(_file);
44
   _file = open(_path.c_str(), O_RDONLY);
44
   _file = open(_path.c_str(), O_RDONLY);
45
+  if (_file < 0) throw XmlFileException(std::string("could not open ") + _path);
45
   posix_fadvise(_file, 0, 0, POSIX_FADV_SEQUENTIAL);
46
   posix_fadvise(_file, 0, 0, POSIX_FADV_SEQUENTIAL);
46
 
47
 
47
   _lastBytes = read(_file, _buffer[_which], BUFFER_S);
48
   _lastBytes = read(_file, _buffer[_which], BUFFER_S);