Date: Tue, 30 Sep 1997 02:55:32 +1000 From: Bruce Evans <bde@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 Message-ID: <199709291655.CAA10241@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>> > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709291655.CAA10241>