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
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/file_container.cpp
parent573021d80952bb9b82af4bac6b03622c7231b936 (diff)
Review fixes.
Diffstat (limited to 'coding/file_container.cpp')
-rw-r--r--coding/file_container.cpp14
1 files changed, 12 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
}