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 haven't closely reviewed the rest of this patch yet, but like the general idea once we have getcwd sorted out. -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
