From 05b18a5b9941989f2ae40f6c7a73cfcaf7093163 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Wed, 2 Apr 2014 13:43:16 +0100 Subject: [PATCH] [thin_check] Fix bug in clear needs check logic. Mixed up bools and int returns. --- thin-provisioning/thin_check.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/thin-provisioning/thin_check.cc b/thin-provisioning/thin_check.cc index f5b52c4..e468a02 100644 --- a/thin-provisioning/thin_check.cc +++ b/thin-provisioning/thin_check.cc @@ -232,7 +232,9 @@ namespace { write_superblock(bm, sb); } - bool check(string const &path, flags fs) { + // Returns 0 on success, 1 on failure (this gets returned directly + // by main). + int check(string const &path, flags fs) { error_state err; bool success = false; @@ -244,7 +246,7 @@ namespace { else success = (err == NO_ERROR) ? 0 : 1; - if (success && fs.clear_needs_check_flag_on_success) + if (!success && fs.clear_needs_check_flag_on_success) clear_needs_check(path); } catch (std::exception &e) {