aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-08-23 23:04:17 -0500
committerRob Landley <rob@landley.net>2020-08-23 23:04:17 -0500
commitfab8d674b398231333f39fab7da821fb82212069 (patch)
tree297d0ababad2b1010ff3692c7e3ad72758b921e3 /toys
parentdfd403c8d24e881d09703a580cb6a3c8d257adf3 (diff)
downloadtoybox-fab8d674b398231333f39fab7da821fb82212069.tar.gz
mv should only prompt for file being unwriteable when stdin is a tty.
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);