diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-07-26 21:29:46 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-07-26 21:29:46 +0000 |
commit | 739a2369f3fde466582aad4efc412de60bd572d4 (patch) | |
tree | 43a8c0e79e69fa99104cec1f43e77a7248a44586 /bin/mv/mv.c | |
parent | 1451ec45f4e62edb09a5a35974e0347ba8ff4069 (diff) |
When using the -i option, check for the existence of the source file before
asking for confirmation, and if it doesn't exist, just complain and exit. This
is NetBSD PR/8073; deraadt@ ok.
Diffstat (limited to 'bin/mv/mv.c')
-rw-r--r-- | bin/mv/mv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 064f667732e..2ef0350e470 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mv.c,v 1.13 1999/01/12 04:42:23 aaron Exp $ */ +/* $OpenBSD: mv.c,v 1.14 1999/07/26 21:29:45 aaron Exp $ */ /* $NetBSD: mv.c,v 1.9 1995/03/21 09:06:52 cgd Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: mv.c,v 1.13 1999/01/12 04:42:23 aaron Exp $"; +static char rcsid[] = "$OpenBSD: mv.c,v 1.14 1999/07/26 21:29:45 aaron Exp $"; #endif #endif /* not lint */ @@ -189,7 +189,7 @@ do_move(from, to) int ask = 1; int ch, first; - if (iflg) { + if (iflg && !access(from, F_OK)) { (void)fprintf(stderr, "overwrite %s? ", to); } else if (stdin_ok && access(to, W_OK) && !stat(to, &sb)) { strmode(sb.st_mode, modep); |