-/* $OpenBSD: cp.c,v 1.46 2017/06/27 21:49:47 tedu Exp $ */
+/* $OpenBSD: cp.c,v 1.47 2018/09/07 07:11:16 martijn Exp $ */
/* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */
/*
struct stat to_stat;
FTS *ftsp;
FTSENT *curr;
- int base, nlen, rval;
+ int base, cval, nlen, rval;
char *p, *target_mid;
base = 0;
!fts_dne(curr)))
rval = 1;
} else
- if (copy_file(curr, fts_dne(curr)))
+ if ((cval = copy_file(curr, fts_dne(curr))) == 1)
rval = 1;
- if (!rval && vflag)
+ if (!cval && vflag)
(void)fprintf(stdout, "%s -> %s\n",
curr->fts_path, to.p_path);
+ cval = 0;
break;
case S_IFIFO:
if (Rflag) {
if (copy_fifo(curr->fts_statp, !fts_dne(curr)))
rval = 1;
} else
- if (copy_file(curr, fts_dne(curr)))
+ if ((cval = copy_file(curr, fts_dne(curr))) == 1)
rval = 1;
- if (!rval && vflag)
+ if (!cval && vflag)
(void)fprintf(stdout, "%s -> %s\n",
curr->fts_path, to.p_path);
+ cval = 0;
break;
case S_IFSOCK:
warnc(EOPNOTSUPP, "%s", curr->fts_path);
break;
default:
- if (copy_file(curr, fts_dne(curr)))
+ if ((cval = copy_file(curr, fts_dne(curr))) == 1)
rval = 1;
- else if (vflag)
+ if (!cval && vflag)
(void)fprintf(stdout, "%s -> %s\n",
curr->fts_path, to.p_path);
+ cval = 0;
break;
}
}
-/* $OpenBSD: utils.c,v 1.40 2017/06/27 21:43:46 tedu Exp $ */
+/* $OpenBSD: utils.c,v 1.41 2018/09/07 07:11:16 martijn Exp $ */
/* $NetBSD: utils.c,v 1.6 1997/02/26 14:40:51 cgd Exp $ */
/*-
ch = getchar();
if (checkch != 'y' && checkch != 'Y') {
(void)close(from_fd);
- return (0);
+ return (2);
}
}
to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);