Re: Don't fail to read a file because it's non-seekable (e.g., a pipe).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

+1

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]