mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
gmessages: Clear address before passing it to getpeername()
This will probably make no functional difference, but will squash a warning from scan-build: ``` ../../../../source/glib/glib/gmessages.c:2243:42: warning: The left operand of '==' is a garbage value [core.UndefinedBinaryOperatorResult] if (err == 0 && addr.storage.ss_family == AF_UNIX) ~~~~~~~~~~~~~~~~~~~~~~ ^ ``` It seems like a reasonable thing to warn about. Initialising the full union to zero should avoid any possibility of undefined behaviour like that. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #1767
This commit is contained in:
parent
606bdcdb18
commit
7a1a9259a1
@ -2238,6 +2238,7 @@ g_log_writer_is_journald (gint output_fd)
|
||||
/* Namespaced journals start with `/run/systemd/journal.${name}/` (see
|
||||
* `RuntimeDirectory=systemd/journal.%i` in `systemd-journald@.service`. The
|
||||
* default journal starts with `/run/systemd/journal/`. */
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
addr_len = sizeof(addr);
|
||||
err = getpeername (output_fd, &addr.sa, &addr_len);
|
||||
if (err == 0 && addr.storage.ss_family == AF_UNIX)
|
||||
|
Loading…
Reference in New Issue
Block a user