summaryrefslogtreecommitdiff
path: root/src/Store.cc
diff options
context:
space:
mode:
authorRichard Kettlewell <rjk@terraraq.org.uk>2018-02-15 20:27:38 +0000
committerRichard Kettlewell <rjk@terraraq.org.uk>2018-07-27 18:26:58 +0100
commit40456b4f710fe5b8cf5a25b8ac412dc5c7094957 (patch)
tree5e9113e3317b1f942402c71347d1ba52cba8fbd9 /src/Store.cc
parent39c681b56df58660f23d10258a410a648266b0b7 (diff)
Store directories (normally) have to be mount points
This can be disabled with new options to store and store-pattern. fixes #42
Diffstat (limited to 'src/Store.cc')
-rw-r--r--src/Store.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Store.cc b/src/Store.cc
index 5add94f..543c7cd 100644
--- a/src/Store.cc
+++ b/src/Store.cc
@@ -1,4 +1,4 @@
-// Copyright © 2011, 2012 Richard Kettlewell.
+// Copyright © 2011-13, 2015-18 Richard Kettlewell.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -34,6 +34,14 @@ void Store::identify() {
return; // already identified
if(stat(path.c_str(), &sb) < 0)
throw BadStore("store '" + path + "' does not exist");
+ if(mounted) {
+ const std::string parent_path = path + "/..";
+ struct stat parent_sb;
+ if(stat(parent_path.c_str(), &parent_sb) < 0)
+ throw FatalStoreError("cannot stat '" + parent_path);
+ if(sb.st_dev == parent_sb.st_dev)
+ throw UnavailableStore("store '" + path + "' is not mounted");
+ }
// Make sure backup devices are mounted
preDeviceAccess();
// Read the device name