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.
The attached patch corrects this behaviour by not unlinking files
when action=warn.
--- cfengine-2.2.1/src/image.c.orig 2007-06-11 12:21:47.000000000 +0100
+++ cfengine-2.2.1/src/image.c 2007-06-11 12:58:28.000000000 +0100
@@ -1501,8 +1501,15 @@
}
else
{
- Verbose("Removing old hard link %s to preserve structure..\n",value);
- unlink(value);
+ if (strcmp(ip->action,"warn") == 0)
+ {
+ Verbose("Need to remove old hard link %s to preserve
structure..\n",value);
+ }
+ else
+ {
+ Verbose("Removing old hard link %s to preserve structure..\n",value);
+ unlink(value);
+ }
}
}
}
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine