summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadori.C5
1 files 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;