diff options
| author | as145665 <none@none> | 2007-03-14 13:41:07 -0700 |
|---|---|---|
| committer | as145665 <none@none> | 2007-03-14 13:41:07 -0700 |
| commit | 0f6e7ba6e1c0f032e0e839fdba06b2e0ddb0c0d4 (patch) | |
| tree | b8682a7682314a7b6c06004314fa1f49190a9c06 /usr/src/cmd/mv | |
| parent | 3d37c6172c543d29232a82ef47013f5c5b7bf30a (diff) | |
| download | illumos-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.c | 30 |
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: "), |
