void xexit(int status)
{
+ if (status > 1) goto _do_clean_and_exit;
+
xclose(sfd);
if (do_ftrunc > TFC_NO_FTRUNC) {
if (do_ftrunc == TFC_FTRUNC_TAIL) ftrunc_dfd = total_processed_dst;
if (do_preserve_time) fcopy_matime(dfd, &s_stat);
xclose(dfd);
+_do_clean_and_exit:
memset(srcblk, 0, sizeof(srcblk));
memset(dstblk, 0, sizeof(dstblk));
fd = open(logfile, O_WRONLY | O_CREAT | O_LARGEFILE | O_TRUNC, 0666);
if (fd == -1) xerror(NO, NO, YES, "%s", logfile);
xclose(2);
- if (dup2(fd, 2) == -1) xerror(NO, NO, YES, "dup2(%d, 2) for %s", fd, logfile);
+ if (dup2(fd, 2) == -1) xexit(2);
xclose(fd);
do_statline_dynamic = NO;
}