Avoid leaving a file open on error return.

This commit is contained in:
Wayne Davison
2019-01-15 10:38:00 -08:00
parent c2da3809f7
commit f233dffbd6

1
util.c
View File

@@ -342,6 +342,7 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
if (robust_unlink(dest) && errno != ENOENT) {
int save_errno = errno;
rsyserr(FERROR_XFER, errno, "unlink %s", full_fname(dest));
close(ifd);
errno = save_errno;
return -1;
}