kldxref: report errors and handle cross-device rename
If the temporary hint file was created on a different filesystem than
the final resting place of the resulting `linker.hints` file, rename(2)
would fail with `EXDEV`. There was no checking for errors after the call
to rename(2), so the `kldxref` operation would appear to succeed but
would not actually write out a new `linker.hints` file.
This patch adds both error checking/reporting and a fix for the `EXDEV`
situation by resorting to copying the file and unlinking the temporary
source.
Additionally, if rename(2) failed but it wasn't an `EXDEV` situation, we
now inform the user that this step failed.
This error was observed when putting together a filesystem layout for a live cd from disparate sources.
Sponsored by: NeoSmart Technologies