Date: 29 Sep 1997 15:39:26 +0200 From: Wolfram Schneider <wosch@cs.tu-berlin.de> To: cvs-committers@freebsd.org, cvs-all@freebsd.org, cvs-bin@freebsd.org Subject: Re: cvs commit: src/bin/mv mv.c Message-ID: <p1i7mc0fddd.fsf@panke.panke.de> In-Reply-To: Wolfram Schneider's message of 28 Sep 1997 23:13:52 %2B0200 References: <199709281041.DAA22093@freefall.freebsd.org> <p1i4t75cfan.fsf@panke.panke.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Wolfram Schneider <wosch@cs.tu-berlin.de> 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 <wosch@apfel.de> http://www.apfel.de/~wosch/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p1i7mc0fddd.fsf>