[Libguestfs] [PATCH nbdkit v2 4/4] server: debug: Escape debug strings
Richard W.M. Jones
rjones at redhat.com
Tue May 9 14:26:25 UTC 2023
On Tue, May 09, 2023 at 03:05:41PM +0200, Laszlo Ersek wrote:
[...]
> Then, in the post-patch version, the following catches my eye:
>
> fp_inner = open_memstream (&str_inner, &len_inner);
> if (fp_inner == NULL) {
> fail:
> /* Try to emit what we can. */
> errno = err;
> vfprintf (stderr, fs, args);
> fprintf (stderr, "\n");
> return;
> }
> errno = err;
> vfprintf (fp_inner, fs, args);
>
> Here a common "errno = err" assignment can be factored out, placed just
> after the "fp_inner" assignment. But this isn't really relevant, as
> fixing problem (2) -- i.e., moving "fail" at the end of the function --
> might reorder the code such that this code extraction is no longer
> needed or possible.
I'd prefer to keep the duplicated errno assignment. It needs to be
right before the call to vfprintf so that %m expands correctly in the
format string.
Agreed on the other points.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
More information about the Libguestfs
mailing list