Re: [PATCH] tests: Lower stack usage below 4096 bytes

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

 



On 04/25/2011 10:57 AM, Eric Blake wrote:
> On 04/24/2011 04:26 PM, Matthias Bolte wrote:
>> Make virtTestLoadFile allocate the buffer to read the file into.
>>
>> Fix logic error in virtTestLoadFile, stop reading on the an empty line.
>>
>> Use virFileReadLimFD in virtTestCaptureProgramOutput.
>> ---
>> +++ b/tests/commandhelper.c
>> @@ -99,8 +99,8 @@ int main(int argc, char **argv) {
>>      }
>>  
>>      fprintf(log, "DAEMON:%s\n", getpgrp() == getsid(0) ? "yes" : "no");
>> -    char cwd[1024];
>> -    if (!getcwd(cwd, sizeof(cwd)))
>> +    char *cwd = NULL;
>> +    if (!(cwd = getcwd(NULL, 0)))
> 
> Ouch.  This is not portable to POSIX, and while gnulib can guarantee
> that it works, the current gnulib getcwd module is GPL (and relies on
> openat, which is a rather heavy-weight replacement!).
> 
> I'm going to work on a gnulib module getcwd-lgpl which doesn't fix all
> the known bugs in getcwd, but at least guarantees that getcwd(NULL,0)
> will malloc insofar as the underlying getcwd is not buggy; we'll need to
> import that into libvirt before applying the rest of this patch.

I've now done that.  Should we review my patches first, then rebase this
on top of my cleanups?  If nothing else, it makes the cleanup in the
tests/ directory much smaller.

https://www.redhat.com/archives/libvir-list/2011-April/msg01255.html

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]