diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-04-08 14:24:03 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-04-08 14:55:47 +0200 |
commit | 4b66c490b41e8ea18428828707ed4327734f92dc (patch) | |
tree | 2dab5679b594fc1ff7c15a21e91b0f849c6d0b66 /src/mbgl/util/io.cpp | |
parent | 7d58a41de5dbf1b24b8bad9a2a98c21a7bf75382 (diff) | |
download | qtlocation-mapboxgl-4b66c490b41e8ea18428828707ed4327734f92dc.tar.gz |
guard against invalid database files
Diffstat (limited to 'src/mbgl/util/io.cpp')
-rw-r--r-- | src/mbgl/util/io.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mbgl/util/io.cpp b/src/mbgl/util/io.cpp index 76f7c35ade..bb4c3595c3 100644 --- a/src/mbgl/util/io.cpp +++ b/src/mbgl/util/io.cpp @@ -4,7 +4,8 @@ #include <iostream> #include <sstream> #include <fstream> -#include <stdexcept> + +#include <unistd.h> namespace mbgl { namespace util { @@ -30,5 +31,12 @@ std::string read_file(const std::string &filename) { } } +void deleteFile(const std::string& filename) { + const int ret = unlink(filename.c_str()); + if (ret == -1) { + throw IOException(errno, "failed to unlink file"); + } +} + } } |