Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/coding
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2016-06-03 00:29:19 +0300
committerYuri Gorshenin <y@maps.me>2016-06-03 16:26:12 +0300
commit85ee45b48220988cb098e20268000d361434c4e2 (patch)
tree9f03f1c87d5c2fbae98821efde4029b7a6e17e15 /coding
parent573021d80952bb9b82af4bac6b03622c7231b936 (diff)
Review fixes.
Diffstat (limited to 'coding')
-rw-r--r--coding/file_container.cpp14
-rw-r--r--coding/reader.hpp1
2 files changed, 13 insertions, 2 deletions
diff --git a/coding/file_container.cpp b/coding/file_container.cpp
index ebe1fbaa51..e37dc86731 100644
--- a/coding/file_container.cpp
+++ b/coding/file_container.cpp
@@ -6,7 +6,6 @@
#include "std/cstring.hpp"
#ifndef OMIM_OS_WINDOWS
- #include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
@@ -20,6 +19,7 @@
#include <windows.h>
#endif
+#include <errno.h>
template <class TSource, class InfoT> void Read(TSource & src, InfoT & i)
{
@@ -124,7 +124,17 @@ void MappedFile::Open(string const & fName)
#else
m_fd = open(fName.c_str(), O_RDONLY | O_NONBLOCK);
if (m_fd == -1)
- MYTHROW(Reader::OpenException, ("Can't open file:", fName, ", reason:", strerror(errno)));
+ {
+ if (errno == EMFILE || errno == ENFILE)
+ {
+ MYTHROW(Reader::TooManyFilesException,
+ ("Can't open file:", fName, ", reason:", strerror(errno)));
+ }
+ else
+ {
+ MYTHROW(Reader::OpenException, ("Can't open file:", fName, ", reason:", strerror(errno)));
+ }
+ }
#endif
}
diff --git a/coding/reader.hpp b/coding/reader.hpp
index bfc03cc797..df70e03143 100644
--- a/coding/reader.hpp
+++ b/coding/reader.hpp
@@ -19,6 +19,7 @@ public:
DECLARE_EXCEPTION(OpenException, Exception);
DECLARE_EXCEPTION(SizeException, Exception);
DECLARE_EXCEPTION(ReadException, Exception);
+ DECLARE_EXCEPTION(TooManyFilesException, Exception);
virtual ~Reader() {}
virtual uint64_t Size() const = 0;