summaryrefslogtreecommitdiffstats
path: root/bin/mv
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1997-09-28 10:41:40 +0000
committerwosch <wosch@FreeBSD.org>1997-09-28 10:41:40 +0000
commit043e6810da2e67f351c2efe635516828d71fa2a4 (patch)
treeb216732052facd46b67817a18f5498d7c0e920c8 /bin/mv
parent97238e083413308273e149d36e3ddabb73e08881 (diff)
downloadFreeBSD-src-043e6810da2e67f351c2efe635516828d71fa2a4.zip
FreeBSD-src-043e6810da2e67f351c2efe635516828d71fa2a4.tar.gz
Endless loop.
$ touch from to $ echo -n loop | mv -i from to overwrite to? ^C
Diffstat (limited to 'bin/mv')
-rw-r--r--bin/mv/mv.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index ea6db6d..96d62a1 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mv.c,v 1.12 1997/03/08 16:05:44 guido Exp $
+ * $Id: mv.c,v 1.13 1997/03/28 15:24:26 imp Exp $
*/
#ifndef lint
@@ -142,7 +142,7 @@ do_move(from, to)
char *from, *to;
{
struct stat sb;
- int ask, ch;
+ int ask, ch, first;
char modep[15];
/*
@@ -171,9 +171,10 @@ do_move(from, to)
ask = 1;
}
if (ask) {
- if ((ch = getchar()) != EOF && ch != '\n')
- while (getchar() != '\n');
- if (ch != 'y' && ch != 'Y')
+ first = ch = getchar();
+ while (ch != '\n' && ch != EOF)
+ ch = getchar();
+ if (first != 'y' && first != 'Y')
return (0);
}
}
OpenPOWER on IntegriCloud