Jim Meyering <jim@xxxxxxxxxxxx> wrote: > FYI, I expect to add fread_file_lim or something like it to gnulib, > and it already has some unit tests (passed). > I removed the "* tab-width: 4" line because it seriously > mangled the code that I initially added. Besides saying "tab-width 4" > is contradictory with the "indent-tabs-mode: nil" setting. > > This fix addresses a problem exposed in an ovirt script whereby > trying to use bash process substitution, e.g., in > virsh define <(command to generate xml) > would fail. > > Oops. Just noticed that the indentation in the added function > (gnulib style) is not consistent with the rest of the file. > I'll adjust that before committing, of course. > > Don't fail to read a file because it's non-seekable (e.g., a pipe). > * src/util.c (fread_file_lim): New function. > (__virFileReadAll): Use fread_file_lim, rather than requiring > that stat.st_size provide a usable file size. > * tests/read-non-seekable: New test, for the above. > * tests/Makefile.am (test_scripts): Add read-non-seekable. > * tests/test-lib.sh (mkfifo_or_skip_): New helper function. One possible change: realloc the result to fit the size of the just-read data. Otherwise, even a small string ends up using a BUFSIZ+1-byte buffer. -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list