Skip to content

Commit

Permalink
[thin_restore] check the input file exists.
Browse files Browse the repository at this point in the history
Previously we were hanging if it didn't
  • Loading branch information
jthornber committed Sep 16, 2013
1 parent 14122d6 commit 7ce306c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions thin-provisioning/thin_restore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// with thin-provisioning-tools. If not, see
// <http://www.gnu.org/licenses/>.

#include "persistent-data/file_utils.h"
#include "thin-provisioning/emitter.h"
#include "thin-provisioning/human_readable_format.h"
#include "thin-provisioning/metadata.h"
Expand Down Expand Up @@ -45,6 +46,8 @@ namespace {
// The block size gets updated by the restorer.
metadata::ptr md(new metadata(dev, metadata::CREATE, 128, 0));
emitter::ptr restorer = create_restore_emitter(md);

check_file_exists(backup_file);
ifstream in(backup_file.c_str(), ifstream::in);
parse_xml(in, restorer);

Expand Down

0 comments on commit 7ce306c

Please sign in to comment.