[Libguestfs] [PATCH miniexpect 2/2] Add debugging capability at runtime.

Pino Toscano ptoscano at redhat.com
Thu Oct 12 14:12:23 UTC 2017


On Wednesday, 11 October 2017 17:23:45 CEST Richard W.M. Jones wrote:
> +static int
> +mexp_vprintf (mexp_h *h, int password, const char *fs, va_list args)
>  {
> -  va_list args;
>    char *msg;
>    int len;
>    size_t n;
>    ssize_t r;
>    char *p;
>  
> -  va_start (args, fs);
>    len = vasprintf (&msg, fs, args);
> -  va_end (args);

Due to the nature of va_list (whose implementation greatly differs per
architecture -- from a pointer, to a list of pointers, to structs, etc),
I think that here you need to copy the va_list using va_copy(), and
pass the copy to vasprintf.

I cannot find a better reference, but
https://stackoverflow.com/questions/3369588/pass-va-list-or-pointer-to-va-list
has a piece of advice on that.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171012/64186269/attachment.sig>


More information about the Libguestfs mailing list