From 40456b4f710fe5b8cf5a25b8ac412dc5c7094957 Mon Sep 17 00:00:00 2001 From: Richard Kettlewell Date: Thu, 15 Feb 2018 20:27:38 +0000 Subject: Store directories (normally) have to be mount points This can be disabled with new options to store and store-pattern. fixes #42 --- src/Store.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Store.cc') 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 -- cgit v1.2.3