From owner-cvs-bin Mon Sep 29 09:56:22 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA22313 for cvs-bin-outgoing; Mon, 29 Sep 1997 09:56:22 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id JAA22287; Mon, 29 Sep 1997 09:56:03 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id CAA10241; Tue, 30 Sep 1997 02:55:32 +1000 Date: Tue, 30 Sep 1997 02:55:32 +1000 From: Bruce Evans Message-Id: <199709291655.CAA10241@godzilla.zeta.org.au> To: cvs-all@FreeBSD.ORG, cvs-bin@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, wosch@cs.tu-berlin.de Subject: Re: cvs commit: src/bin/mv mv.c Sender: owner-cvs-bin@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> > Endless loop. >> >> This bug exist in serveral programs, e.g. vipw(8) and disklabel(8). > >I don't have a free disk handy. Can someone test this patch? No excuse :-). test with a vn disk. >@@ -833,11 +833,10 @@ > } > fclose(fp); > printf("re-edit the label? [y]: "); fflush(stdout); >- c = getchar(); >- if (c != EOF && c != (int)'\n') >- while (getchar() != (int)'\n') >- ; >- if (c == (int)'n') >+ first = c = getchar(); >+ while (c != '\n' && c != EOF) >+ c = getchar(); >+ if (first == (int)'n') > break; > } > (void) unlink(tmpfil); This isn't quite right, since the default is 'y', and EOF should not be taken as 'y'. The prompt is more misleading than usual (anything other than 'n' is taken as 'y', so 'N' is taken as 'y'). There is still one useless cast to int. Bruce