From owner-cvs-bin Mon Sep 29 09:31:34 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA20690 for cvs-bin-outgoing; Mon, 29 Sep 1997 09:31:34 -0700 (PDT) Received: from mail.cs.tu-berlin.de (root@mail.cs.tu-berlin.de [130.149.17.13]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id JAA20680; Mon, 29 Sep 1997 09:31:26 -0700 (PDT) Received: from panke.panke.de (anonymous214.ppp.cs.tu-berlin.de [130.149.17.214]) by mail.cs.tu-berlin.de (8.8.6/8.8.7) with ESMTP id SAA02796; Mon, 29 Sep 1997 18:28:38 +0200 (MET DST) Received: (from wosch@localhost) by panke.panke.de (8.8.5/8.6.12) id PAA13331; Mon, 29 Sep 1997 15:39:28 +0200 (MET DST) To: cvs-committers@freebsd.org, cvs-all@freebsd.org, cvs-bin@freebsd.org Subject: Re: cvs commit: src/bin/mv mv.c References: <199709281041.DAA22093@freefall.freebsd.org> From: Wolfram Schneider Date: 29 Sep 1997 15:39:26 +0200 In-Reply-To: Wolfram Schneider's message of 28 Sep 1997 23:13:52 +0200 Message-ID: Lines: 47 Sender: owner-cvs-bin@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Wolfram Schneider writes: > > wosch 1997/09/28 03:41:42 PDT > > Modified files: > > bin/mv mv.c > > Log: > > 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? Index: disklabel.c =================================================================== RCS file: /usr/cvs/src/sbin/disklabel/disklabel.c,v retrieving revision 1.12 diff -u -r1.12 disklabel.c --- disklabel.c 1997/06/10 11:08:53 1.12 +++ disklabel.c 1997/09/29 13:25:01 @@ -802,7 +802,7 @@ struct disklabel *lp; int f; { - register int c, fd; + register int c, fd, first; struct disklabel label; FILE *fp; @@ -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); -- Wolfram Schneider http://www.apfel.de/~wosch/