From 2cad5033359975238cbb95824595b638892bc039 Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Sat, 27 Oct 2018 21:37:40 +0200 Subject: move dry-run checking into do_link --- hadori.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hadori.C b/hadori.C index f5aebda..4465ef3 100644 --- a/hadori.C +++ b/hadori.C @@ -71,6 +71,8 @@ inline std::ostream& operator<< (std::ostream& os, inode const & i) { } static void do_link (inode const & i, std::string const & other) { + if (config.count("dry-run")) + return; if (!link(i.filename.c_str(), other.c_str())) { error << "linking " << i << " to " << other << " succeeded before unlinking (race condition)" << std::endl; exit(EX_UNAVAILABLE); @@ -129,8 +131,7 @@ static void handle_file (std::string const & path, struct stat const & s) { verbose << "linking " << candidate << " to " << path << std::endl; if (s.st_nlink > 1) to_link.insert({s.st_ino, it.second}); - if (not config.count("dry-run")) - do_link(candidate, path); + do_link(candidate, path); return; } debug << "we keep " << f << std::endl; -- cgit v1.2.3