mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-12 12:14:06 +02:00
gdump: Do not overwrite GError contents
In case of multiple IO failures we may try to use a GError multiple times, avoid so. See: https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/411#note_1812951
This commit is contained in:
committed by
Marco Trevisan
parent
d3d6fd6809
commit
b347a44e5e
11
gdump.c
11
gdump.c
@@ -669,14 +669,11 @@ g_irepository_dump (const char *arg, GError **error)
|
|||||||
goutput_write (G_OUTPUT_STREAM (output), "</dump>\n");
|
goutput_write (G_OUTPUT_STREAM (output), "</dump>\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
GError **ioerror;
|
|
||||||
/* Avoid overwriting an earlier set error */
|
/* Avoid overwriting an earlier set error */
|
||||||
if (caught_error)
|
caught_error |= !g_input_stream_close (G_INPUT_STREAM (in), NULL,
|
||||||
ioerror = NULL;
|
caught_error ? NULL : error);
|
||||||
else
|
caught_error |= !g_output_stream_close (G_OUTPUT_STREAM (output), NULL,
|
||||||
ioerror = error;
|
caught_error ? NULL : error);
|
||||||
caught_error |= !g_input_stream_close (G_INPUT_STREAM (in), NULL, ioerror);
|
|
||||||
caught_error |= !g_output_stream_close (G_OUTPUT_STREAM (output), NULL, ioerror);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (in);
|
g_object_unref (in);
|
||||||
|
Reference in New Issue
Block a user