On Fri, Jul 22, 2011 at 10:15:40PM +0200, Sami Kerola wrote: > This is a fix to an issue with llvm clang which I reported > earlier. > > http://www.spinics.net/lists/util-linux-ng/msg04331.html > > When compiling with clang fscanf format string %[\n] will not > work. Sure, read scanf man page. The %[] format expects string + null byte. The bug is in the scriptreplay.c code where we don't have room for the null byte :-( I really don't think that this a llvm bug. > --- a/term-utils/scriptreplay.c > +++ b/term-utils/scriptreplay.c > @@ -203,7 +203,7 @@ main(int argc, char *argv[]) > size_t blk; > char nl; ^^^^^^^^ > > - if ((fscanf(tfile, "%lf %zd%[\n]\n", &delay, &blk, &nl) != 3) || > + if ((fscanf(tfile, "%lf %zd%c\n", &delay, &blk, &nl) != 3) || > (nl != '\n')) { Yep, it seems usable. Anyway, it's usually better to use fgets() + sscanf() to read and parse lines from files. The fscanf() could be tricky if your format depends on whitespaces. Applied, thanks. Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html