summaryrefslogtreecommitdiffstats
path: root/bin/mv
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2012-11-15 15:05:51 +0000
committereadler <eadler@FreeBSD.org>2012-11-15 15:05:51 +0000
commit5649923ed0db340e50f85da233f55d743481b465 (patch)
treecbe8d294acc0408734aecce1f93a6ff49f6a27b7 /bin/mv
parent220ecf68cc0e16048390f8af0404f7ee4cecf105 (diff)
downloadFreeBSD-src-5649923ed0db340e50f85da233f55d743481b465.zip
FreeBSD-src-5649923ed0db340e50f85da233f55d743481b465.tar.gz
Follow the behavior as specified in POSIX:
if (exists AND (NOT f_option) AND ((not_writable AND input_is_terminal) OR i_option)) prompt in particular, add the test for input_is_terminal PR: bin/173039 Submitted by: Mark Johnston <markjdb@gmail.com> Approved by: cperciva MFC after: 3 days
Diffstat (limited to 'bin/mv')
-rw-r--r--bin/mv/mv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index d33b28d..5147a2db 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -199,7 +199,7 @@ do_move(const char *from, const char *to)
} else if (iflg) {
(void)fprintf(stderr, "overwrite %s? %s", to, YESNO);
ask = 1;
- } else if (access(to, W_OK) && !stat(to, &sb)) {
+ } else if (access(to, W_OK) && !stat(to, &sb) && isatty(STDIN_FILENO)) {
strmode(sb.st_mode, modep);
(void)fprintf(stderr, "override %s%s%s/%s for %s? %s",
modep + 1, modep[9] == ' ' ? "" : " ",
OpenPOWER on IntegriCloud