On Thu, Jul 24, 2014 at 08:31:01PM +0200, Marc Marí wrote:
> @@ -397,10 +398,18 @@ QDict *qtest_qmpv(QTestState *s, const char *fmt, 
> va_list ap)
>  
>      /* No need to send anything for an empty QObject.  */
>      if (qobj) {
> +        size_t len;
> +        int log = getenv("QTEST_LOG") != NULL;
>          QString *qstr = qobject_to_json(qobj);
>          const char *str = qstring_get_str(qstr);
>          size_t size = qstring_get_length(qstr);
>  
> +        if (log) {
> +            len = write(2, str, size);
> +            if (len != size) {
> +                fprintf(stderr, "Could not log\n");

It's a bit funny that we print an error message to stderr after failing
to write to stderr.

Why not just fprintf(stderr, "%s", str) instead of using write()?

Attachment: pgpL2e_NNatZz.pgp
Description: PGP signature

Reply via email to