[PATCH 2/3] tests: Don't pass INT_MAX to virFileReadAll()

Michal Prívozník mprivozn at redhat.com
Mon Jun 14 12:14:47 UTC 2021


On 6/14/21 1:31 PM, Tim Wiederhake wrote:
> On Mon, 2021-06-14 at 13:06 +0200, Michal Privoznik wrote:
>> In a few occasions in tests we pass INT_MAX to
>> virFileReadLimFD(). This is not safe because virFileReadAll()
>> will call virFileReadLimFD() under the hood which takes the limit
>> and adds 1 to it.
> 
> Calling virFileReadAll with "INT_MAX - 1" looks funny. Is it possible
> to check for "maxlen >= INT_MAX" in virFileReadLimFD instead?

Actually, I don't understand why we need to add 1 in the first place.
I'll push the other two patches and send v2 for this that removes the +1.

Michal




More information about the libvir-list mailing list