Hard link bug

This patch fixes a bug where cfengine may irrevocably delete files with multiple hard links.

This patch was merged into cfengine 2.2.2.

Download

Hard link bug fix for cfengine 2.2.1

Description

When cfagent runs a copy rule and finds multiple hardlinks to the same inode, it calls RegisterHardLink() to remove all but one of the links.

However, if the rule is set with action=warn, cfagent will not then restore the unlinked files, which are lost.

This patch corrects this behaviour by not unlinking files when action=warn.