mayday: split out common symlink code