aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/cp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index 09e5701f..cd8a7b15 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -432,7 +432,7 @@ void cp_main(void)
// Prompt if -i or file isn't writable. Technically "is writable" is
// more complicated (022 is not writeable by the owner, just everybody
// _else_) but I don't care.
- if (exists && (FLAG(i) || !(st.st_mode & 0222))) {
+ if (exists && (FLAG(i) || (!(st.st_mode & 0222) && isatty(0)))) {
fprintf(stderr, "%s: overwrite '%s'", toys.which->name, TT.destname);
if (!yesno(0)) rc = 0;
else unlink(TT.destname);