summaryrefslogtreecommitdiff
path: root/usr/src/cmd/mv
diff options
context:
space:
mode:
authoras145665 <none@none>2007-03-14 13:41:07 -0700
committeras145665 <none@none>2007-03-14 13:41:07 -0700
commit0f6e7ba6e1c0f032e0e839fdba06b2e0ddb0c0d4 (patch)
treeb8682a7682314a7b6c06004314fa1f49190a9c06 /usr/src/cmd/mv
parent3d37c6172c543d29232a82ef47013f5c5b7bf30a (diff)
downloadillumos-joyent-0f6e7ba6e1c0f032e0e839fdba06b2e0ddb0c0d4.tar.gz
6493712 mv does not stop on question, with a messy output
Diffstat (limited to 'usr/src/cmd/mv')
-rw-r--r--usr/src/cmd/mv/mv.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/usr/src/cmd/mv/mv.c b/usr/src/cmd/mv/mv.c
index 8efd38bfdd..2cacb121e5 100644
--- a/usr/src/cmd/mv/mv.c
+++ b/usr/src/cmd/mv/mv.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1228,16 +1228,26 @@ chkfiles(char *source, char **to)
override = !cpy && (access(target, 2) < 0) &&
!silent && use_stdin() && !ISLNK(s2);
- if (overwrite && override)
+ if (overwrite && override) {
(void) fprintf(stderr,
gettext("%s: overwrite %s and override "
"protection %o (%s/%s)? "), cmd, target,
FMODE(s2) & MODEBITS, yeschr, nochr);
- else if (overwrite && ISREG(s2))
+ if (getresp()) {
+ if (buf != NULL)
+ free(buf);
+ return (2);
+ }
+ } else if (overwrite && ISREG(s2)) {
(void) fprintf(stderr,
gettext("%s: overwrite %s (%s/%s)? "),
cmd, target, yeschr, nochr);
- else if (override)
+ if (getresp()) {
+ if (buf != NULL)
+ free(buf);
+ return (2);
+ }
+ } else if (override) {
(void) fprintf(stderr,
gettext("%s: %s: override protection "
/*CSTYLED*/
@@ -1245,15 +1255,13 @@ chkfiles(char *source, char **to)
/*CSTYLED*/
cmd, target, FMODE(s2) & MODEBITS,
yeschr, nochr);
- if (overwrite || override) {
- if (ISREG(s2)) {
- if (getresp()) {
- if (buf != NULL)
- free(buf);
- return (2);
- }
+ if (getresp()) {
+ if (buf != NULL)
+ free(buf);
+ return (2);
}
}
+
if (lnk && unlink(target) < 0) {
(void) fprintf(stderr,
gettext("%s: cannot unlink %s: "),