mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
Revert "Fix error format in gio/gunixconnection.c (part 2)"
This reverts commit 4ae8606b6f
. The idea
for the change [1] was to address a build error for certain compilers
that trigger a `format-nonliteral` error-promoted-warning since these
compilers do not gracefully support `ngettext` usage. The changes
following a pattern from an old commit [2]; however, James Hilliard has
pointed out these changes do not work as intended. A deeper inspection
of the commit showed that the commit was from an old merge request that
was not pulled in, detailing why the changes did not work (see also
[3][4]).
Manipulating the sockets unit test confirms that the format values no
longer get a proper value:
...
ok 9 /socket/address
ok 10 /socket/unix-from-fd
ok 11 /socket/unix-connection
**
GLib-GIO:ERROR:../gio/tests/socket.c:1493:test_unix_connection_ancillary_data: assertion failed (err == NULL): Expecting one fd, but got %d
(g-io-error-quark, 0)
...
And reverting this change restores the original functionality:
...
ok 9 /socket/address
ok 10 /socket/unix-from-fd
ok 11 /socket/unix-connection
**
GLib-GIO:ERROR:../gio/tests/socket.c:1493:test_unix_connection_ancillary_data: assertion failed (err == NULL): Expecting 1 control message, got 0 (g-io-error-quark, 0)
...
[1]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3390
[2]: 44b3d5d80445234041f6c59feb89645f7102c3a4
[3]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/770
[4]: https://gitlab.gnome.org/GNOME/glib/-/issues/1744
Signed-off-by: James Knight <james.d.knight@live.com>
This commit is contained in:
parent
c176fcf2eb
commit
0ca660315a
@ -176,10 +176,11 @@ g_unix_connection_receive_fd (GUnixConnection *connection,
|
||||
{
|
||||
gint i;
|
||||
|
||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
ngettext ("Expecting 1 control message, got %d",
|
||||
"Expecting 1 control message, got %d",
|
||||
nscm));
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
ngettext("Expecting 1 control message, got %d",
|
||||
"Expecting 1 control message, got %d",
|
||||
nscm),
|
||||
nscm);
|
||||
|
||||
for (i = 0; i < nscm; i++)
|
||||
g_object_unref (scms[i]);
|
||||
@ -209,10 +210,11 @@ g_unix_connection_receive_fd (GUnixConnection *connection,
|
||||
{
|
||||
gint i;
|
||||
|
||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
ngettext ("Expecting one fd, but got %d\n",
|
||||
"Expecting one fd, but got %d\n",
|
||||
nfd));
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
ngettext("Expecting one fd, but got %d\n",
|
||||
"Expecting one fd, but got %d\n",
|
||||
nfd),
|
||||
nfd);
|
||||
|
||||
for (i = 0; i < nfd; i++)
|
||||
close (fds[i]);
|
||||
@ -590,12 +592,13 @@ g_unix_connection_receive_credentials (GUnixConnection *connection,
|
||||
{
|
||||
if (nscm != 1)
|
||||
{
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
ngettext ("Expecting 1 control message, got %d",
|
||||
"Expecting 1 control message, got %d",
|
||||
nscm));
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
ngettext("Expecting 1 control message, got %d",
|
||||
"Expecting 1 control message, got %d",
|
||||
nscm),
|
||||
nscm);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user