I noticed relocate2 recently. Unfortunately, it's rather awkward to use, as it requires one to keep track of two pointers.
The obvious "lazy" API for code that doesn't mind allocation is for the relocated path always to be allocated. Would a patch to add such a version of relocate (suggestions for name?) be acceptable? It would work exactly like relocate, but strdup its return value if necessary.
--