copy-file: add error-code-returning variant.