[Libvir] Don't fail to read a file because it's non-seekable (e.g., a pipe).
Daniel P. Berrange
berrange at redhat.com
Tue Apr 8 16:39:35 UTC 2008
On Tue, Apr 08, 2008 at 04:04:53PM +0100, Richard W.M. Jones wrote:
> On Tue, Apr 08, 2008 at 05:00:03PM +0200, Jim Meyering wrote:
> > 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.
> This fix looks good. In fact I'd go further and remove the test for
> S_ISDIR(st.st_mode) and the stat buffer altogether.
Yep I agree - patch looks good aside from that.
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list