summaryrefslogtreecommitdiff
path: root/src/cstore/unionfs/cstore-unionfs.cpp
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-11-22 17:05:20 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2010-11-22 17:05:20 -0800
commitd3afe297be72fdfbc8590b4ce1ac4912e4ccae5c (patch)
treee1f53f03dfa091f14ec756482b1295537ee4085f /src/cstore/unionfs/cstore-unionfs.cpp
parent0d80dd5111390ddab46fda1e251e0673b2238d85 (diff)
downloadvyatta-cfg-d3afe297be72fdfbc8590b4ce1ac4912e4ccae5c.tar.gz
vyatta-cfg-d3afe297be72fdfbc8590b4ce1ac4912e4ccae5c.zip
fix for bug 6459
* don't throw away "unsaved" state when doing "discard".
Diffstat (limited to 'src/cstore/unionfs/cstore-unionfs.cpp')
-rw-r--r--src/cstore/unionfs/cstore-unionfs.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp
index f125f37..e2e27c6 100644
--- a/src/cstore/unionfs/cstore-unionfs.cpp
+++ b/src/cstore/unionfs/cstore-unionfs.cpp
@@ -840,7 +840,10 @@ UnionfsCstore::set_comment(const string& comment)
bool
UnionfsCstore::discard_changes(unsigned long long& num_removed)
{
- // unionfs-specific implementation
+ // need to keep unsaved marker
+ bool unsaved = sessionUnsaved();
+ bool ret = true;
+
vector<b_fs::path> files;
vector<b_fs::path> directories;
try {
@@ -866,9 +869,15 @@ UnionfsCstore::discard_changes(unsigned long long& num_removed)
} catch (...) {
output_internal("discard failed [%s]\n",
change_root.file_string().c_str());
- return false;
+ ret = false;
}
- return true;
+
+ if (unsaved) {
+ // restore unsaved marker
+ num_removed--;
+ markSessionUnsaved();
+ }
+ return ret;
}
// get comment at the current work or active path