From 982099ef1f57990118fd4644f7e706bfd05ebdcd Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 6 Oct 2004 06:58:53 +0000 Subject: [PATCH] If we get an EOF in check2(), terminate the yes/no question loop rather then looping forever. --- bin/rm/rm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 675fb46bfc..fad026e6e4 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1990, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)rm.c 8.5 (Berkeley) 4/18/94 * $FreeBSD: src/bin/rm/rm.c,v 1.29.2.5 2002/07/12 07:25:48 tjr Exp $ - * $DragonFly: src/bin/rm/rm.c,v 1.5 2004/10/06 06:45:04 dillon Exp $ + * $DragonFly: src/bin/rm/rm.c,v 1.6 2004/10/06 06:58:53 dillon Exp $ */ #include @@ -495,6 +495,8 @@ check2(char **argv) first = ch = getchar(); while (ch != '\n' && ch != EOF) ch = getchar(); + if (ch == EOF) + break; } return (first == 'y' || first == 'Y'); } -- 2.41.0